|
org.netbeans.modules.sendopts/2 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.spi.sendopts.OptionProcessor
public abstract class OptionProcessor
A subclass of this class shall be registered in
META-INF/services/org.netbeans.spi.sendopts.OptionProcessor
file (see Lookup
for description of how to do it and why)
in order to register it for participation on handling
and processing of command line options initiated by
CommandLine.getDefault()
's
CommandLine.process(java.lang.String[])
.
When the Option
s provided by this processor are found
on the command line and are consistent, this processor's process(org.netbeans.spi.sendopts.Env, java.util.Map
method is going to be called to handle their values and invoke an action.
The usual pattern for writing a subclass of processor is:
public class MyProcessor extends OptionProcessor { private Option option1 = ...; private Option option2 = ...; private Option option3 = ...; protected Set
Constructor Summary | |
---|---|
protected |
OptionProcessor()
Constructor for subclasses. |
Method Summary | |
---|---|
protected abstract Set<Option> |
getOptions()
Method to override in subclasses to create the right set of Option s. |
protected abstract void |
process(Env env,
Map<Option,String[]> optionValues)
Called by the sendopts parsing infrastructure as a result of CommandLine.process(java.lang.String[]) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected OptionProcessor()
Method Detail |
---|
protected abstract Set<Option> getOptions()
Option
s.
See the factory methods that are part of the Option
's javadoc
or read the
usecases for the sendopts API.
process(org.netbeans.spi.sendopts.Env, java.util.Map)
method will be invoked to
handle such option and its valuesprotected abstract void process(Env env, Map<Option,String[]> optionValues) throws CommandException
CommandLine.process(java.lang.String[])
. The method shall read the values
associated with the option(s) this OptionProcessor
defines
and invoke an action to handle them. While doing this it can
communicate with external world using its environment (see Env
).
Such environment provides access to current user directory, standard
output and error streams, as well standard input stream. In case
the processing of options fails, the code shall thrown CommandException
.
env
- the environment to communicate withoptionValues
- map of all options that appeared on command line with their values
CommandException
- in case the processing fails1
|
org.netbeans.modules.sendopts/2 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |