提交 1642a98e 编写于 作者: K kohsuke

turns out these are unnecessary.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21446 71c3de6d-444a-0410-be80-ed276b4c234a
上级 65de7809
package hudson.cli.declarative;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.ClassParser;
import org.kohsuke.args4j.CmdLineException;
import hudson.model.Hudson;
/**
* Used to parse a portion of arguments to resolve to a model object, for which {@link CLIMethod} will be invoked.
*
* <p>
* This object is stateful. Typical subtype contains a number of fields and setter methods with args4j annotations.
* The CLI framework creates an instance of {@link CLIInstanceResolver} from {@link CLIInstanceResolverFactory},
* call {@link #defineOptionsTo(CmdLineParser)}, then let {@link CmdLineParser} parses the arguments, which
* fills this object with parameters and arguments.
*
* <p>
* Finally, the CLI framework will call {@link #resolve()} to obtain the object, and that is the object
* that the command will act on.
*
* @author Kohsuke Kawaguchi
* @see CLIInstanceResolverFactory
* @since 1.324
*/
public abstract class CLIInstanceResolver<T> {
/**
* Fills the given {@link CmdLineParser} by defining options and arguments that this resolver uses.
*
* <p>
* The default implementation expects the resolver instance itself to be annotated with args4j annotations.
*/
public void defineOptionsTo(CmdLineParser parser) {
new ClassParser().parse(this,parser);
}
/**
* Called after {@link CmdLineParser} parsed arguments, to resolve the instance.
*
* @return
* must not be null.
*/
public abstract T resolve() throws CmdLineException;
}
package hudson.cli.declarative;
import hudson.ExtensionPoint;
import hudson.Extension;
/**
* Extension point for resolving an instance of a model object, from the arguments and options given to CLI.
*
* <p>
* To have your implementation registered, put {@link Extension} on your implementation.
*
* @author Kohsuke Kawaguchi
* @since 1.324
*/
public abstract class CLIInstanceResolverFactory implements ExtensionPoint {
/**
* Creates a new instance of {@link CLIInstanceResolver} that can resolve the given type.
*
* @return
* null if this factory doens't understand the given type, in which case the caller
* will continue to search the rest of the factories for a match.
*/
public abstract <T> CLIInstanceResolver<? extends T> create(Class<T> type);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册