public class SimpleVariable extends Observable implements Variable
Constructor and Description |
---|
SimpleVariable(java.lang.Object value)
creates a variable with an initial value.
|
SimpleVariable(java.lang.Object value,
java.util.List validValues)
creates a variable with an initial value and a list of valid values.
|
SimpleVariable(java.lang.Object value,
java.lang.Object... validValues)
creates a variable with an initial value and a comma separated list of
valid values.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getValue()
returns the variable's value.
|
void |
setValidator(Validator validator)
sets the validator for this object.
|
void |
setValue(java.lang.Object value)
sets the variable's value.
|
void |
validate(java.lang.Object value)
validates the
value . |
addObserver, clone, fireChangeEvent, removeObserver
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addObserver, clone, fireChangeEvent, removeObserver
public SimpleVariable(java.lang.Object value)
value
- the initial valuepublic SimpleVariable(java.lang.Object value, java.util.List validValues)
value
- the initial valuevalidValues
- the list of valid valuespublic SimpleVariable(java.lang.Object value, java.lang.Object... validValues)
value
- the initial valuevalidValues
- the list of valid valuespublic void setValidator(Validator validator)
validator
- the validator objectpublic void validate(java.lang.Object value)
value
.
Validates the value by calling Validator.validate(Object)
if the
validator has been set by setValidator(Validator)
, else
validates against list of valid values if a list of valid values was
passed to the variable constructor.
public void setValue(java.lang.Object value)