Package com.martiansoftware.jsap.ant
Class ParameterConfiguration
java.lang.Object
com.martiansoftware.jsap.ant.ParameterConfiguration
- Direct Known Subclasses:
OptionConfiguration,SwitchConfiguration
public abstract class ParameterConfiguration
extends java.lang.Object
Stores/provides configuration data common to switches, 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:
JSAPAntTask
-
Constructor Summary
Constructors Constructor Description ParameterConfiguration()Creates a new ParameterConfiguration. -
Method Summary
Modifier and Type Method Description voidaddConfiguredDefault(DefaultValue defaultValue)Adds a configured default value to the current list of default values for this parameter.abstract voidcreateMethod(java.lang.String methodName, java.io.PrintStream out)Creates source code for a java method that creates a parameter matching this object's configuration.java.lang.String[]getDefaults()Returns an array of this parameter's default values, or a zero-length array if none exist.java.lang.StringgetId()Returns the unique ID for this parameter.abstract ParametergetParameter()Returns an Parameter (String, FlaggedOption, or UnflaggedOption) configured according to the settings contained within this object.booleanhasProperties()Returns a boolean indicating whether this parameter has any properties associated with its StringParser.voidsetDefault(java.lang.String defaultValue)Adds a default value to the current list of default values for this parameter.voidsetId(java.lang.String id)Sets the unique ID for this parameter.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ParameterConfiguration
public ParameterConfiguration()Creates a new ParameterConfiguration.
-
-
Method Details
-
getParameter
Returns an Parameter (String, FlaggedOption, or UnflaggedOption) configured according to the settings contained within this object.- Returns:
- an Parameter (String, FlaggedOption, or UnflaggedOption) configured according to the settings contained within this object.
-
setId
public void setId(java.lang.String id)Sets the unique ID for this parameter.- Parameters:
id- ths unique ID for this parameter.
-
getId
public java.lang.String getId()Returns the unique ID for this parameter.- Returns:
- the unique ID for this parameter.
-
setDefault
public void setDefault(java.lang.String defaultValue)Adds a default value to the current list of default values for this parameter.- Parameters:
defaultValue- the default value to add to the current list of default values for this parameter.
-
addConfiguredDefault
Adds a configured default value to the current list of default values for this parameter.- Parameters:
defaultValue- the configured default value to add to the current list of default values for this parameter.
-
getDefaults
public java.lang.String[] getDefaults()Returns an array of this parameter's default values, or a zero-length array if none exist.- Returns:
- an array of this parameter's default values, or a zero-length array if none exist.
-
hasProperties
public boolean hasProperties()Returns a boolean indicating whether this parameter has any properties associated with its StringParser. This method always returns false; it may be overridden by subclasses.- Returns:
- a boolean indicating whether this parameter has any properties associated with its StringParser.
-
createMethod
public abstract void createMethod(java.lang.String methodName, java.io.PrintStream out) throws java.io.IOExceptionCreates source code for a java method that creates a parameter matching this object's configuration.- Parameters:
methodName- the name of the java method to generate.out- the PrintStream to which the generated source code should be written.- Throws:
java.io.IOException- if any are thrown by PrintStream.
-