com.tobedevoured.command.Plan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Make Java do your bidding by turning any code into an executable
The newest version!
package com.tobedevoured.command;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Plan used to execute a method on an {@link com.tobedevoured.command.annotation.ByYourCommand} annotated Class
*
* @author Michael Guymon
*/
public class Plan {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
protected CommandMethod defaultCommand;
protected Map commands;
protected Class target;
protected String targetName;
protected String targetGroup;
/**
* Construct new instance
*/
public Plan() {
commands = new HashMap();
}
/**
* Add a {@link com.tobedevoured.command.annotation.Command}
*
* @param command CommandMethod
*/
public void addCommand( CommandMethod command ) {
commands.put(command.getName(), command );
}
/**
* Execute the default Command with params for this Plan
*
* @param params List
* @param resolver DependencyResolvable
* @return {@link CommandMethod} that was executed
* @throws CommandException fails to exec command
*/
public CommandMethod exec( List