com.jbbres.lib.actions.elements
Interface VariableService

All Superinterfaces:
ElementService
All Known Implementing Classes:
AbstractVariableService, RuntimeVariable, SimpleVariable, StorageVariable

public interface VariableService
extends ElementService

The service provided by a variable.

The service is a major part of a variable as it defined its behavior within a workflow. It describes how the element performs during the workflow execution. For a variable, the service provides:

Since:
1.0.0
Version:
1.0.0
Author:
Jean-Baptiste Bres
See Also:
Variable.getService()

Method Summary
 void addVariableServiceListener(VariableServiceListener l)
          Adds a listener to this variable.
 java.lang.String getInstanceName()
          Returns the variable instance name.
 java.lang.Object getValue()
          Returns the current value of the variable.
 boolean isEditable()
          Defines if the value of the variable can be modified by using the setValue(C) method.
 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.
 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.
 

Method Detail

getValue

java.lang.Object getValue()
Returns the current value of the variable.

Returns:
the current value of the variable
See Also:
setValue(Object), valueClass()

setValue

java.lang.Object setValue(java.lang.Object newValue)
                          throws InvalidVariableValueException
Sets the current value of the variable.

Parameters:
newValue - - the new value of the variable.
Returns:
the previous value of the variable, or null if the variable had no value before the call of this method.
Throws:
InvalidVariableValueException - if an invalid value is trying to be assigned to the variable
See Also:
getValue(), isValidValueClass(Class)

valueClass

java.lang.Class<? extends java.lang.Object> valueClass()
Returns the type of the object returned by the getValue method.

Returns:
the type of the object returned by the getValue method
See Also:
getValue()

isValidValueClass

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.

Parameters:
clazz - - the clazz
Returns:
true if an instance of the given class is an acceptable value for the variable. false otherwise.
See Also:
setValue(Object)

getInstanceName

java.lang.String getInstanceName()
Returns the variable instance name. This name is assigned by the user when adding the variable into the workflow.

Returns:
the variable instance name.
See Also:
setInstanceName(String)

setInstanceName

void setInstanceName(java.lang.String name)
                     throws InvalidVariableInstanceNameException
Sets the variable instance name.

Parameters:
name - - new instance name
Throws:
InvalidVariableInstanceNameException - if the instance name is not valid, for example if another variable in the workflow has a similar instance name.
See Also:
getInstanceName()

isEditable

boolean isEditable()
Defines if the value of the variable can be modified by using the setValue(C) method.

If this methods returns true, calling the setValue(C) method should have no effect.

Returns:
true if the value of the variable can be modified by using the setValue(C) method. false otherwise.

addVariableServiceListener

void addVariableServiceListener(VariableServiceListener l)
Adds a listener to this variable.

Parameters:
l - - the new listener
See Also:
removeVariableServiceListener(VariableServiceListener)

removeVariableServiceListener

void removeVariableServiceListener(VariableServiceListener l)
Removes a listener to this variable.

Parameters:
l - - the listener to remove
See Also:
addVariableServiceListener(VariableServiceListener)


To file bugs or suggest feature enhancements, visit the app.jbbres.com Bug Reporter website.

Additional documentation available online at http://app.jbbres.com/actions/developers.

Copyright � 2009-2011 app.jbbres.com. All Rights Reserved.