SHARE
TWEET

Untitled

a guest Oct 10th, 2015 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public final <T extends StateComponent> void execute(Command<T> command) {
  2.                 final Class<CommandListener> type = CommandListener.class;
  3.                 if (hasComponent(command.getListeningClass())) {
  4.                         for (StateComponent component : components) {
  5.                                 if (command.getListeningClass().isInstance(component)) {
  6.                                         command.execute(type.cast(component));
  7.                                 }
  8.                         }
  9.                 }
  10.         }
  11.  
  12.  
  13. public abstract class Command<T extends CommandListener> {
  14.     private final Class<T> listeningClass;
  15.     protected Command(final Class<T> listeningClass) {
  16.         this.listeningClass = listeningClass;
  17.     }
  18.     public abstract void execute(final T listener);
  19.     public final Class<T> getListeningClass() {
  20.         return listeningClass;
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top