
com.opencredo.concursus.mapping.commands.methods.dispatching.CommandMethodDispatcher Maven / Gradle / Ivy
The newest version!
package com.opencredo.concursus.mapping.commands.methods.dispatching;
import com.opencredo.concursus.domain.commands.Command;
import com.opencredo.concursus.domain.commands.dispatching.CommandProcessor;
import com.opencredo.concursus.domain.commands.dispatching.CommandSubscribable;
import com.opencredo.concursus.mapping.commands.methods.reflection.CommandInterfaceInfo;
import com.opencredo.concursus.mapping.commands.methods.reflection.MultiTypeCommandDispatcher;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import static com.google.common.base.Preconditions.checkNotNull;
public final class CommandMethodDispatcher implements CommandProcessor {
public static CommandMethodDispatcher toHandler(Class extends H> handlerInterface, H target) {
checkNotNull(handlerInterface, "handlerInterface must not be null");
checkNotNull(target, "target must not be null");
return new CommandMethodDispatcher(target, CommandInterfaceInfo.forInterface(handlerInterface).getCommandDispatcher());
}
private final Object target;
private final MultiTypeCommandDispatcher commandDispatcher;
private CommandMethodDispatcher(Object target, MultiTypeCommandDispatcher commandDispatcher) {
this.target = target;
this.commandDispatcher = commandDispatcher;
}
@Override
public Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy