com.singularsys.jep.misc.boundvariable

## 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 a `BoundVariable` will be created.

  Since:
    Jep 3.5
  Author:
    Richard Morris
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected VariableBindingMapper` | `vbm`

    - ### Fields inherited from class com.singularsys.jep.VariableFactory

      `defaultValue`

  - ### Constructor Summary

    Constructors
    Constructor and 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 and Description
    --- | ---
    `Variable` | `createVariable(java.lang.String name)` Create a variable with a name but not value
    `Variable` | `createVariable(java.lang.String name, java.lang.Object value)` If the value is an instance of `VariableBinding` then call the `createVariable(String, VariableBinding)` method, otherwise treat as normal.
    `Variable` | `createVariable(java.lang.String name, VariableBinding vb)` Creates a variable with the given VariableBinding
    `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 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
      Overrides:
        `createVariable` in class `VariableFactory`
      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 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(java.lang.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

Copyright © 2018 Singular Systems http://www.singularsys.com/jep