Package com.martiansoftware.jsap.ant
Class OptionConfiguration
java.lang.Object
com.martiansoftware.jsap.ant.ParameterConfiguration
com.martiansoftware.jsap.ant.OptionConfiguration
- Direct Known Subclasses:
FlaggedOptionConfiguration
,UnflaggedOptionConfiguration
Stores/provides configuration data common to both flaggedoptions and
unflaggedoptions nested inside a jsap ant task.
For detailed information on using the jsap task, see the documentation for
JSAPAntTask.
- Author:
- Marty Lamb
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a property to the current list of properties for this option's PropertyStringParser.protected void
createParentStatements
(String objName, PrintStream out) Creates java source code to configure an option as specified in this object.boolean
Returns a boolean indicating whether the list separator character has been specified by the user.boolean
Returns a boolean indicating whether this option is a list.char
Returns the list separator character for this option.Returns an array of ParserProperties for this option's PropertyStringParser, or null if no ParserProperties are defined.boolean
Returns a boolean indicating whether this option is required.Returns the classname of the StringParser for this option.boolean
Returns a boolean indicating whether any ParserProperties are defined.void
setIslist
(boolean isList) Sets whether this option is a list.void
setListseparator
(char listSeparator) Sets the list separator for this option, if it is a list.void
setRequired
(boolean required) Sets whether this option is required.void
setStringparser
(String stringParser) Sets the StringParser for this option.protected void
setupStringParser
(Option option) Instantiates and configures AStringParser
according to this configuration, and provides it to the specified Option.Methods inherited from class com.martiansoftware.jsap.ant.ParameterConfiguration
addConfiguredDefault, createMethod, getDefaults, getId, getParameter, setDefault, setId
-
Constructor Details
-
OptionConfiguration
public OptionConfiguration()Creates a new OptionConfiguration.
-
-
Method Details
-
setStringparser
Sets the StringParser for this option.- Parameters:
stringParser
- the StringParser for this option.
-
getStringparser
Returns the classname of the StringParser for this option. If the current StringParser name does not contains any "dot" characters, it is prefixed with "com.martiansoftware.jsap.stringparsers." prior to returning.- Returns:
- the classname of the StringParser for this option.
-
setRequired
public void setRequired(boolean required) Sets whether this option is required.- Parameters:
required
- if true, this option is required.
-
getRequired
public boolean getRequired()Returns a boolean indicating whether this option is required.- Returns:
- a boolean indicating whether this option is required.
-
setIslist
public void setIslist(boolean isList) Sets whether this option is a list.- Parameters:
isList
- if true, this option is a list.
-
getIslist
public boolean getIslist()Returns a boolean indicating whether this option is a list.- Returns:
- a boolean indicating whether this option is a list.
-
setListseparator
public void setListseparator(char listSeparator) Sets the list separator for this option, if it is a list.- Parameters:
listSeparator
- the list separator character for this option, if it is a list.
-
getListseparator
public char getListseparator()Returns the list separator character for this option.- Returns:
- the list separator character for this option.
-
declaredListSeparator
public boolean declaredListSeparator()Returns a boolean indicating whether the list separator character has been specified by the user.- Returns:
- a boolean indicating whether the list separator character has been specified by the user.
-
addConfiguredProperty
Adds a property to the current list of properties for this option's PropertyStringParser.- Parameters:
p
- the property to add.
-
getParserProperties
Returns an array of ParserProperties for this option's PropertyStringParser, or null if no ParserProperties are defined.- Returns:
- an array of ParserProperties for this option's PropertyStringParser, or null if no ParserProperties are defined.
-
hasProperties
public boolean hasProperties()Returns a boolean indicating whether any ParserProperties are defined.- Overrides:
hasProperties
in classParameterConfiguration
- Returns:
- a boolean indicating whether any ParserProperties are defined.
-
setupStringParser
Instantiates and configures AStringParser
according to this configuration, and provides it to the specified Option.- Parameters:
option
- the Option that should use the configured StringParser.
-
createParentStatements
Creates java source code to configure an option as specified in this object. These methods are called by both UnflaggedOptionConfiguration and FlaggedOptionConfiguration.- Overrides:
createParentStatements
in classParameterConfiguration
- Parameters:
objName
- the name of the object in the generated source codeout
- a PrintStream to which the source code should be written
-