Package adams.flow.core
Class FlowVariables
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.Variables
-
- adams.flow.core.FlowVariables
-
- All Implemented Interfaces:
CleanUpHandler
,CloneHandler<Variables>
,LoggingSupporter
,SizeOfHandler
,Serializable
public class FlowVariables extends Variables
Enhanced variable management, which allows referencing callable actors in variable names ("@{callable:actorname}") in order to obtain output value of actor.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CALLABLEREF_NOT_FOUND
the default value if callable reference could not be expanded.protected Actor
m_Flow
the flow reference.protected CallableActorHelper
m_Helper
the helper class.static String
PREFIX_CALLABLEACTOR
the callable actor reference prefix.static String
PREFIX_STORAGE
the storage reference prefix.static String
STORAGEREF_NOT_FOUND
the default value if storage reference could not be expanded.-
Fields inherited from class adams.core.Variables
CHARS, END, ENVIRONMENT_VARIABLE_PREFIX, m_EnvironmentVariables, m_SystemProperties, m_VariableChangeListeners, m_Variables, START, SYSTEM_PROPERTY_PREFIX
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FlowVariables()
Initializes the container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(Variables other)
Adds all the variables from the other Variables object (overwrites any existing ones).void
cleanUp()
Cleans up data structures, frees up memory.protected String
doExpand(String s)
Performs all expansions.protected String
doExpandGlobalRefs(String s)
Expands regular variables.String
get(String name, String defValue)
Returns the stored value if present, otherwise the default value.protected Object
getCallableActorValue(String name, Object defValue)
Returns the value obtain from the callable actor.Actor
getFlow()
Returns the flow to obtain callable actors from.Object
getObject(String name, Object defValue)
Returns the stored value.protected Object
getStorageValue(String name, Object defValue)
Returns the value obtain from storage.boolean
has(String name)
Checks whether a variable is stored or not.boolean
hasFlow()
Checks whether a flow reference is available.boolean
isObject(String name)
Returns whether the stored value is present as non-string object.void
setFlow(Actor value)
Sets the flow to obtain callable actors from.-
Methods inherited from class adams.core.Variables
addVariableChangeListener, assign, clear, createValidName, doExpandEnv, doExpandRegular, doExpandSystemProps, expand, expand, extractName, extractNames, get, getClone, getClone, getObject, hasVariableChangeListener, isPlaceholder, isValidName, names, nameSet, notifyVariableChangeListeners, padName, remove, remove, removeVariableChangeListener, removeVariableChangeListeners, set, size, toString, toValidName, toValidName
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
PREFIX_CALLABLEACTOR
public static final String PREFIX_CALLABLEACTOR
the callable actor reference prefix.- See Also:
- Constant Field Values
-
CALLABLEREF_NOT_FOUND
public static final String CALLABLEREF_NOT_FOUND
the default value if callable reference could not be expanded.- See Also:
- Constant Field Values
-
PREFIX_STORAGE
public static final String PREFIX_STORAGE
the storage reference prefix.- See Also:
- Constant Field Values
-
STORAGEREF_NOT_FOUND
public static final String STORAGEREF_NOT_FOUND
the default value if storage reference could not be expanded.- See Also:
- Constant Field Values
-
m_Flow
protected Actor m_Flow
the flow reference.
-
m_Helper
protected CallableActorHelper m_Helper
the helper class.
-
-
Method Detail
-
setFlow
public void setFlow(Actor value)
Sets the flow to obtain callable actors from.- Parameters:
value
- the flow reference
-
getFlow
public Actor getFlow()
Returns the flow to obtain callable actors from.- Returns:
- the flow reference
-
hasFlow
public boolean hasFlow()
Checks whether a flow reference is available.- Returns:
- true if reference available
-
assign
public void assign(Variables other)
Adds all the variables from the other Variables object (overwrites any existing ones).
-
has
public boolean has(String name)
Checks whether a variable is stored or not.
-
getCallableActorValue
protected Object getCallableActorValue(String name, Object defValue)
Returns the value obtain from the callable actor.- Parameters:
name
- the name of the callable actordefValue
- the default value- Returns:
- the value obtained from the callable actor, defValue in case of error
-
getStorageValue
protected Object getStorageValue(String name, Object defValue)
Returns the value obtain from storage.- Parameters:
name
- the name of the storage valuedefValue
- the default value- Returns:
- the value obtained from storage, defValue in case of value not present in storage
-
get
public String get(String name, String defValue)
Returns the stored value if present, otherwise the default value.
-
isObject
public boolean isObject(String name)
Returns whether the stored value is present as non-string object.- Overrides:
isObject
in classVariables
- Returns:
- true if the value is stored as non-string
- See Also:
Variables.getObject(String)
-
doExpandGlobalRefs
protected String doExpandGlobalRefs(String s)
Expands regular variables.- Parameters:
s
- the string to expand- Returns:
- the potentially expanded string
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classVariables
-
-