|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.javatools.util.CommandParser
public class CommandParser
A simple command line parser.
CommandModel
Nested Class Summary | |
---|---|
static interface |
CommandParser.Converter<T> An interface for an object which converts a String to a value. |
Constructor Summary | |
---|---|
CommandParser() |
Method Summary | |
---|---|
protected void |
conditionalRequirementUnsatisfied(java.lang.String precedent, java.lang.String precedentValue, java.lang.String antecedent, java.lang.String antecedentValue) |
void |
defineConverter(CommandParser.Converter<?> converter) Defines a converter for a type. |
void |
defineOption(java.lang.String name) Defines an unvalued option. |
void |
defineOption(java.lang.String name, java.lang.Class<?> type) Defines an option. |
void |
defineParameter(java.lang.String name, java.lang.Class<?> type) Defines a parameter. |
void |
defineRequirement(java.lang.String... names) Defines a requirement that one of a list of options or parameters be present. |
void |
defineRequirementAbsent(java.lang.String precedent, java.lang.String antecedent) Defines a requirement that if a parameter or option is present then another parameter or option must be absent. |
void |
defineRequirementPresent(java.lang.String precedent, java.lang.String antecedent) Defines a requirement that if a parameter or option is present then another parameter or option must be present. |
void |
defineSuperseding(java.lang.String... options) Defines a superseding set of options. |
void |
defineSynonym(java.lang.String name, java.lang.String synonym) Defines a synonym for an option. |
CommandParser.Converter |
getConverter(java.lang.Class<?> type) Gets the converter defined for a type. |
java.lang.Class |
getType(java.lang.String name) Gets the value type of a parameter or option, or null for an unvalued option. |
protected void |
invalidOption(java.lang.String name) |
boolean |
isArgumentFilesEnabled() Gets whether argument file support is enabled. |
boolean |
isDefined(java.lang.String name) Gets whether a name is a parameter or option. |
protected void |
missingOptionValue(java.lang.String name, java.lang.Class type) |
protected java.lang.Object |
optionValueConversionFailed(java.lang.String name, java.lang.String typeDescription, java.lang.String argument, java.lang.Throwable e) |
protected java.lang.Object |
parameterValueConversionFailed(java.lang.String name, java.lang.String typeDescription, java.lang.String argument, java.lang.Throwable e) |
CommandModel |
parse(java.lang.String[] arguments) Parses a command line. |
protected void |
requirementsUnsatisfied(java.util.Set parameters, java.lang.String[] requirements) |
void |
setArgumentFilesEnabled(boolean argumentFilesEnabled) Sets whether argument file support is enabled. |
protected void |
unexpectedParameter(java.lang.String name) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommandParser()
Method Detail |
---|
public void setArgumentFilesEnabled(boolean argumentFilesEnabled)
public void defineConverter(CommandParser.Converter<?> converter)
public void defineOption(java.lang.String name)
name
- The canonical name of the option.java.lang.IllegalArgumentException
- if the name is already defined.defineSynonym(java.lang.String, java.lang.String)
public void defineOption(java.lang.String name, java.lang.Class<?> type)
name
- The canonical name of the option.type
- The type of the option value.java.lang.IllegalArgumentException
- if the name is already defined or if no converter is defined for the type.defineSynonym(java.lang.String, java.lang.String)
public void defineParameter(java.lang.String name, java.lang.Class<?> type)
name
- The name of the parameter.type
- The type of the parameter.java.lang.IllegalArgumentException
- if the name is already defined, if no converter is defined for the type, or if a list parameter is already defined.public void defineSuperseding(java.lang.String... options)
options
- The canonical names of the options in the set.java.lang.IllegalArgumentException
- if a name is not defined or is defined to belong to another superseding set.public void defineRequirement(java.lang.String... names)
names
- The canonical names of the options or parameters.java.lang.IllegalArgumentException
- if a name is not defined.public void defineRequirementPresent(java.lang.String precedent, java.lang.String antecedent)
java.lang.IllegalArgumentException
- if either name is not a parameter or option.public void defineRequirementAbsent(java.lang.String precedent, java.lang.String antecedent)
java.lang.IllegalArgumentException
- if either name is not defined.public void defineSynonym(java.lang.String name, java.lang.String synonym)
name
- The canonical name of the option.synonym
- An alternative name for the option.java.lang.IllegalArgumentException
- if the name is not defined or if the synonym is already defined.defineOption(java.lang.String)
public CommandParser.Converter getConverter(java.lang.Class<?> type)
public java.lang.Class getType(java.lang.String name)
name
- The canonical name of the option or parameter.java.lang.IllegalArgumentException
- if the name is not defined.public boolean isArgumentFilesEnabled()
public boolean isDefined(java.lang.String name)
name
- A name.public CommandModel parse(java.lang.String[] arguments) throws CommandException
CommandException
protected void invalidOption(java.lang.String name) throws CommandException
CommandException
protected void missingOptionValue(java.lang.String name, java.lang.Class type) throws CommandException
CommandException
protected java.lang.Object optionValueConversionFailed(java.lang.String name, java.lang.String typeDescription, java.lang.String argument, java.lang.Throwable e) throws CommandException
CommandException
protected void unexpectedParameter(java.lang.String name) throws CommandException
CommandException
protected java.lang.Object parameterValueConversionFailed(java.lang.String name, java.lang.String typeDescription, java.lang.String argument, java.lang.Throwable e) throws CommandException
CommandException
protected void requirementsUnsatisfied(java.util.Set parameters, java.lang.String[] requirements) throws CommandException
CommandException
protected void conditionalRequirementUnsatisfied(java.lang.String precedent, java.lang.String precedentValue, java.lang.String antecedent, java.lang.String antecedentValue) throws CommandException
CommandException
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |