T
- the data type stored in the parameter.public abstract class Parameter<T>
extends java.lang.Object
Parameter
is abstract. A typical implementation defines
the data type T and initialises the valueProperty
field
with a suitable type. For the sake of clarity, it may not be ideal
for a subclass constructor to expose an argument for the monitor
field. Instead, a different class should be created which constructs
the parameter as a monitor, so that the distinction between a regular
parameter and a parameter monitor is more apparent. The boolean, integer
and double implementations of parameter (and their associated monitors)
implement this pattern, refer to them for more details.
status
field holds the current status of the parameter,
which should change whenever the parameter value changes.
In order for this to happen, validate()
is called whenever
the parameter status should be updated. This being the case, it should
be overridden on an instance-to-instance basis, as each parameter
will likely have different validity criteria. The type of status is
ParameterStatus
, an enum type defining all valid states.Module
Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyProperty<T> |
value
This method is intended for bindings only.
|
Modifier and Type | Method and Description |
---|---|
T |
get() |
ParameterStatus |
getStatus() |
boolean |
isCritical() |
boolean |
isMonitor() |
void |
set(T newValue)
Sets the parameter to the specified value, if the property
is not bound.
|
java.lang.String |
toString() |
abstract void |
validate(T newValue)
This is a callback method which gets called whenever changes
to parameters (not only its own instance) are made.
|
javafx.beans.property.ReadOnlyProperty<T> |
valueProperty()
This method is intended for bindings only.
|
public javafx.beans.property.ReadOnlyProperty<T> valueProperty
set()
.public boolean isMonitor()
public boolean isCritical()
public ParameterStatus getStatus()
public javafx.beans.property.ReadOnlyProperty<T> valueProperty()
set()
.public T get()
public void set(T newValue)
newValue
- the new value for the parameter.public abstract void validate(T newValue)
status
field according to the
new value, so that the user can be informed if any parameters
are currently set to invalid values.newValue
- the new value.public java.lang.String toString()
toString
in class java.lang.Object