Class BoundVariableFactory
- java.lang.Object
-
- com.singularsys.jep.VariableFactory
-
- com.singularsys.jep.misc.boundvariable.BoundVariableFactory
-
- All Implemented Interfaces:
JepComponent
,java.io.Serializable
public class BoundVariableFactory extends VariableFactory
A variable factory for creating bound variables.
If a variable is called with an
VariableBinding
as its value then aBoundVariable
will be created.- Since:
- Jep 3.5
- Author:
- Richard Morris
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected VariableBindingMapper
vbm
-
Fields inherited from class com.singularsys.jep.VariableFactory
defaultValue
-
-
Constructor Summary
Constructors Constructor Description BoundVariableFactory()
Create the factory with no VariableMapping.BoundVariableFactory(VariableBindingMapper vbm)
Create the factory with a specific VariableMapping for creation of new variables.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Variable
createVariable(java.lang.String name)
Create a variable with a name but not value CallsVariableFactory.createVariable(String, Object)
so subclasses need not override this method.Variable
createVariable(java.lang.String name, VariableBinding vb)
Creates a variable with the given VariableBindingVariable
createVariable(java.lang.String name, java.lang.Object value)
If the value is an instance ofVariableBinding
then call thecreateVariable(String, VariableBinding)
method, otherwise treat as normal.VariableBindingMapper
getVariableMapping()
Gets the VariableMapping for the creation of new variables.void
setVariableMapping(VariableBindingMapper vm)
Sets the VariableMapping for the creation of new variables.-
Methods inherited from class com.singularsys.jep.VariableFactory
copyVariable, getDefaultValue, getLightWeightInstance, init, setDefaultValue
-
-
-
-
Field Detail
-
vbm
protected VariableBindingMapper vbm
-
-
Constructor Detail
-
BoundVariableFactory
public BoundVariableFactory()
Create the factory with no VariableMapping. When a new variable is requested
-
BoundVariableFactory
public BoundVariableFactory(VariableBindingMapper vbm)
Create the factory with a specific VariableMapping for creation of new variables.- Parameters:
vbm
- the mapping class translates a specific jep varable names to particualr objects
-
-
Method Detail
-
createVariable
public Variable createVariable(java.lang.String name)
Description copied from class:VariableFactory
Create a variable with a name but not value CallsVariableFactory.createVariable(String, Object)
so subclasses need not override this method.- Overrides:
createVariable
in classVariableFactory
- Parameters:
name
- name of variable- Returns:
- referece to Variable object
-
createVariable
public Variable createVariable(java.lang.String name, java.lang.Object value)
If the value is an instance ofVariableBinding
then call thecreateVariable(String, VariableBinding)
method, otherwise treat as normal.- Overrides:
createVariable
in classVariableFactory
- Parameters:
name
- variable namevalue
- either the initial value or a VariableBinding object- Returns:
- the created variable
-
createVariable
public Variable createVariable(java.lang.String name, VariableBinding vb)
Creates a variable with the given VariableBinding- Parameters:
name
- name of the variablevb
- binding object- Returns:
- a new BoundVariable
-
getVariableMapping
public VariableBindingMapper getVariableMapping()
Gets the VariableMapping for the creation of new variables.- Returns:
- the mapping used or null if none set.
-
setVariableMapping
public void setVariableMapping(VariableBindingMapper vm)
Sets the VariableMapping for the creation of new variables.- Parameters:
vm
- the mapping
-
-