Package com.singularsys.jep.misc.boundvariable

# Class BoundVariableFactory

java.lang.Object
com.singularsys.jep.VariableFactory
com.singularsys.jep.misc.boundvariable.BoundVariableFactory

All Implemented Interfaces:
  `JepComponent`, `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 a `BoundVariable` 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

  Modifier and Type
  Method
  Description
  `Variable`
  `createVariable(String name)`
  Create a variable with a name but not value Calls `VariableFactory.createVariable(String, Object)` so subclasses need not override this method.
  `Variable`
  `createVariable(String name, VariableBinding vb)`
  Creates a variable with the given VariableBinding
  `Variable`
  `createVariable(String name, Object value)`
  If the value is an instance of `VariableBinding` then call the `createVariable(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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### vbm

    protected VariableBindingMapper vbm

- ## Constructor Details

  - ### 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 variable names to particular objects

- ## Method Details

  - ### createVariable

    public Variable createVariable(String name)
    Description copied from class: `VariableFactory`
    Create a variable with a name but not value Calls `VariableFactory.createVariable(String, Object)` so subclasses need not override this method.
    Overrides:
      `createVariable` in class `VariableFactory`
    Parameters:
      `name` - name of variable
    Returns:
      reference to Variable object

  - ### createVariable

    public Variable createVariable(String name, Object value)
    If the value is an instance of `VariableBinding` then call the `createVariable(String, VariableBinding)` method, otherwise treat as normal.
    Overrides:
      `createVariable` in class `VariableFactory`
    Parameters:
      `name` - variable name
      `value` - either the initial value or a VariableBinding object
    Returns:
      the created variable

  - ### createVariable

    public Variable createVariable(String name, VariableBinding vb)
    Creates a variable with the given VariableBinding
    Parameters:
      `name` - name of the variable
      `vb` - 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