|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.jonas.newbean.Parameter
public abstract class Parameter
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 java.lang.String |
value
This parameter's value, as entered by the user. |
protected org.apache.velocity.VelocityContext |
vContext
The Velocity context into which this parameter's variables will be exported. |
Constructor Summary | |
---|---|
Parameter(org.apache.velocity.VelocityContext context)
Creates a new parameter that will export its variables into the specified Velocity context. |
Method Summary | |
---|---|
abstract void |
export()
Exports the variables managed by this parameter into the associated Velocity context (ie vContext ). |
abstract java.lang.String |
getArgKeyword()
|
abstract Parameter |
getNextParameter()
Returns the parameter the user will be asked for after this one. |
abstract java.lang.String |
getPrompt()
Returns the string used to prompt the user for a value. |
abstract boolean |
isValid()
Indicates whether this parameter as a valid value. |
void |
obtainValue()
Obtains the value of this parameter. |
void |
setValue(java.lang.String input)
Sets the value of this parameter. |
void |
walkThrough()
Recusively walk through the parameters graph, obtaining parameter ( obtainValue() ) values and exporting (export() ) them. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.velocity.VelocityContext vContext
protected java.lang.String value
Constructor Detail |
---|
public Parameter(org.apache.velocity.VelocityContext context)
context
- the Velocity context into which variables will
be exportedMethod Detail |
---|
public void walkThrough()
obtainValue()
) values and exporting (export()
) them.
The path taken through the parameter graph may change depending
on the values entered by the user. It is determined after each
valid input by a call to getNextParameter()
.
public void obtainValue()
value
through the
isValid()
. This process is repeated until the value is
valid.
public void setValue(java.lang.String input)
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 value
to
input
. You can override this method if you need to
format this input, for example to convert it to uppercase.
public abstract java.lang.String getPrompt()
public abstract boolean isValid()
value
is not null
.
true
if value
is valid,
false
otherwisepublic abstract void export()
vContext
).
public abstract Parameter getNextParameter()
value
.
This method returns null
if their is no more
parameters.
public abstract java.lang.String getArgKeyword()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |