| java.lang.Object org.objectweb.jonas.newbean.Parameter
Parameter | abstract public class Parameter (Code) | | This class represents a parameter the user may be prompted for. It
is responsible for asking the user for a value, validating his
input, exporting relevant datas into Velocity's context, and
deciding what should be the next parameter to ask.
A parameter is created by subclassing this class and overriding the
following abstract methods:
|
Field Summary | |
protected VelocityContext | vContext The Velocity context into which this parameter's variables will
be exported. | protected String | value This parameter's value, as entered by the user. |
Constructor Summary | |
public | Parameter(VelocityContext context) Creates a new parameter that will export its variables into the
specified Velocity context. |
vContext | protected VelocityContext vContext(Code) | | The Velocity context into which this parameter's variables will
be exported.
|
value | protected String value(Code) | | This parameter's value, as entered by the user.
|
Parameter | public Parameter(VelocityContext context)(Code) | | Creates a new parameter that will export its variables into the
specified Velocity context.
Parameters: context - the Velocity context into which variables willbe exported |
export | abstract public void export()(Code) | | Exports the variables managed by this parameter into the
associated Velocity context (ie
Parameter.vContext ).
|
getArgKeyword | abstract public String getArgKeyword()(Code) | | the command line keyword string for this parameter |
getNextParameter | abstract public Parameter getNextParameter()(Code) | | Returns the parameter the user will be asked for after this
one. This method is not invoked before a valid value has been
entered for this parameter; therefor it is possible to decide
which object to return based on the value of
Parameter.value .
This method returns null if their is no more
parameters.
the next parameter the user should be prompted for |
getPrompt | abstract public String getPrompt()(Code) | | Returns the string used to prompt the user for a value.
the string used to prompt the user for a value. |
isValid | abstract public boolean isValid()(Code) | | Indicates whether this parameter as a valid value. This method
can safely assume
Parameter.value is not null .
true if Parameter.value is valid,false otherwise |
obtainValue | public void obtainValue()(Code) | | Obtains the value of this parameter. This method prompts the
user for a value, stores it into
Parameter.value through the
Parameter.isValid() . This process is repeated until the value is
valid.
|
setValue | public void setValue(String input)(Code) | | Sets the
Parameter.value of this parameter. This method is
called each time a value is entered is entered by the user,
before its validity has been checked.
This implementation simply sets
Parameter.value to
input . You can override this method if you need to
format this input, for example to convert it to uppercase.
|
|
|