Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.singularsys.jep
Class VariableFactory

    java.lang.Object
      com.singularsys.jep.VariableFactory

All Implemented Interfaces:
  JepComponent, java.io.Serializable

    public class VariableFactory

extends java.lang.Object
implements JepComponent

A factory class which is used to create variables. By default this class creates variables of type `Variable`. This class should be sub-classed if the type of variable used needs to be changed. This class is passed to the constructor of `VariableTable` which ensures that variables of the correct type are always created.

This class should only be called from the VariableTable class and not from application code.

Since:
  23 July 2006 - allows a defaultValue to be set.
Author:
  Rich Morris Created on 19-Dec-2003
See Also:
  Serialized Form

Field Summary
`protected java.lang.Object` | `defaultValue` The default value to use when variable is created with no value

Constructor Summary
`VariableFactory()`

Method Summary
`Variable` | `copyVariable(Variable var)` Create a new variable which is a copy of this one.
`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)` Create a variable with a name and value
`java.lang.Object` | `getDefaultValue()`
`JepComponent` | `getLightWeightInstance()` Gets a light-weight instance suitable for using in multiple threads.
`void` | `init(Jep j)` Initialize the component.
`void` | `setDefaultValue(java.lang.Object defaultValue)` Sets the default value used whenever a new variable is created.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### defaultValue

    protected java.lang.Object defaultValue

  The default value to use when variable is created with no value

Constructor Detail

### VariableFactory

    public VariableFactory()

Method Detail

### init

    public void init(Jep j)

  Description copied from interface: `JepComponent`
  Initialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.

  Specified by:
    `init` in interface `JepComponent`
  Parameters:
    `j` - the current Jep instance

### createVariable

    public Variable createVariable(java.lang.String name,
                                   java.lang.Object value)

  Create a variable with a name and value

### createVariable

    public Variable createVariable(java.lang.String name)

  Create a variable with a name but not value

### copyVariable

    public Variable copyVariable(Variable var)

  Create a new variable which is a copy of this one.

### getDefaultValue

    public java.lang.Object getDefaultValue()

  Returns:
    Returns the defaultValue.

### setDefaultValue

    public void setDefaultValue(java.lang.Object defaultValue)

  Sets the default value used whenever a new variable is created.

  Parameters:
    `defaultValue` - The defaultValue to set.

### getLightWeightInstance

    public JepComponent getLightWeightInstance()

  Description copied from interface: `JepComponent`
  Gets a light-weight instance suitable for using in multiple threads.

  Specified by:
    `getLightWeightInstance` in interface `JepComponent`
  Returns:
    either an new instance, or 'this'.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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