|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jbbres.lib.actions.tools.elements.AbstractElementService com.jbbres.lib.actions.tools.elements.AbstractVariableService<C>
C
- - Class of the object that the variable can store.public abstract class AbstractVariableService<C>
This abstract class provides default implementations for most of the methods
in the VariableService
interface.
You need to create a sub-class of AbstractVariableService
if you
are implementing a variable based on AbstractVariable
. However, it is
recommended to create your own variables as subclasses of
RuntimeVariable
or StorageVariable
instead.
Constructor Summary | |
---|---|
AbstractVariableService(AbstractVariable variable)
Instantiates a new abstract variable service. |
Method Summary | |
---|---|
void |
addVariableServiceListener(VariableServiceListener l)
Adds a listener to this variable. |
void |
fireVariableInstanceNameChanges(java.lang.String oldInstanceName)
Calls the variableInstanceNameChanges method of all the
listener. |
void |
fireVariableValueChanges(java.lang.Object oldValue)
Calls the variableValueChanges method of all the listener. |
java.lang.String |
getInstanceName()
Returns the variable instance name. |
abstract Parameters |
getParameters()
Returns the current value of the variable, using Parameters
format. |
C |
getValue()
Returns the current value of the variable. |
VariableServiceListener[] |
getVariableListeners()
Returns the variables listeners. |
boolean |
isValidValueClass(java.lang.Class<? extends java.lang.Object> clazz)
Returns true if an instance of the given class is an
acceptable value for the variable. |
void |
removeVariableServiceListener(VariableServiceListener l)
Removes a listener to this variable. |
void |
setInstanceName(java.lang.String name)
Sets the variable instance name. |
abstract void |
setParameters(Parameters parameters)
Sets the value of the variable. |
java.lang.Object |
setValue(java.lang.Object newValue)
Sets the current value of the variable. |
java.lang.Class<? extends java.lang.Object> |
valueClass()
Returns the type of the object returned by the getValue
method. |
Methods inherited from class com.jbbres.lib.actions.tools.elements.AbstractElementService |
---|
getDescription, getParent, getWorkflow |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.jbbres.lib.actions.elements.VariableService |
---|
isEditable |
Constructor Detail |
---|
public AbstractVariableService(AbstractVariable variable)
variable
- - the parent variableMethod Detail |
---|
public java.lang.Object setValue(java.lang.Object newValue) throws InvalidVariableValueException
VariableService
setValue
in interface VariableService
newValue
- - the new value of the variable.
null
if the
variable had no value before the call of this method.
InvalidVariableValueException
- if an invalid value is trying to be assigned to the variableVariableService.getValue()
,
VariableService.isValidValueClass(Class)
public java.lang.Class<? extends java.lang.Object> valueClass()
VariableService
getValue
method.
valueClass
in interface VariableService
getValue
methodVariableService.getValue()
public boolean isValidValueClass(java.lang.Class<? extends java.lang.Object> clazz)
VariableService
true
if an instance of the given class is an
acceptable value for the variable.
isValidValueClass
in interface VariableService
clazz
- - the clazz
true
if an instance of the given class is an
acceptable value for the variable. false
otherwise.VariableService.setValue(Object)
public C getValue()
VariableService
getValue
in interface VariableService
VariableService.setValue(Object)
,
VariableService.valueClass()
public java.lang.String getInstanceName()
VariableService
getInstanceName
in interface VariableService
VariableService.setInstanceName(String)
public void setInstanceName(java.lang.String name) throws InvalidVariableInstanceNameException
VariableService
setInstanceName
in interface VariableService
name
- - new instance name
InvalidVariableInstanceNameException
- if the instance name is not valid, for example if another
variable in the workflow has a similar instance name.VariableService.getInstanceName()
public abstract Parameters getParameters()
Parameters
format. The value can be stored in a file and restore calling the
setParameters
method. This method can return
null
.
setParameters(Parameters)
public abstract void setParameters(Parameters parameters) throws InvalidParametersException
parameters
- - the parameters. Can be null
InvalidParametersException
- Raised when the paramters received are incorrect and cannot
be mapped in the element.getParameters()
public void addVariableServiceListener(VariableServiceListener l)
VariableService
addVariableServiceListener
in interface VariableService
l
- - the new listenerVariableService.removeVariableServiceListener(VariableServiceListener)
public void removeVariableServiceListener(VariableServiceListener l)
VariableService
removeVariableServiceListener
in interface VariableService
l
- - the listener to removeVariableService.addVariableServiceListener(VariableServiceListener)
public VariableServiceListener[] getVariableListeners()
public void fireVariableValueChanges(java.lang.Object oldValue)
variableValueChanges
method of all the listener.
oldValue
- - previous value of the variablepublic void fireVariableInstanceNameChanges(java.lang.String oldInstanceName)
variableInstanceNameChanges
method of all the
listener.
oldInstanceName
- - previous instanceName
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |