- public final <T extends StateComponent> void execute(Command<T> command) {
- final Class<CommandListener> type = CommandListener.class;
- if (hasComponent(command.getListeningClass())) {
- for (StateComponent component : components) {
- if (command.getListeningClass().isInstance(component)) {
- command.execute(type.cast(component));
- }
- }
- }
- }
- public abstract class Command<T extends CommandListener> {
- private final Class<T> listeningClass;
- protected Command(final Class<T> listeningClass) {
- this.listeningClass = listeningClass;
- }
- public abstract void execute(final T listener);
- public final Class<T> getListeningClass() {
- return listeningClass;
- }
- }
SHARE
TWEET
Untitled
a guest
Oct 10th, 2015
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
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.

