public static final class DataAccess.Variable<T>
extends java.lang.Object
any_instance---------------->| other_instance-------------->| Variable |--value------->references_somewhat ^ \ | ------>other_reference is changed:
Map< String, DataAccess.Variable>
which is used to access in the DataAccess
class and which is used especially for variables in the org.vishia.cmd.JZtxtcmdExecuter#setScriptVariable(String, Object)
and org.vishia.cmd.JZtxtcmdExecuter.ExecuteLevel#setLocalVariable(String, Object)
which are accessed with the DataAccess
class while setting and evaluating.
A user can build a datapool independently of the JZcmd approach writing the code:
Map< String, DataAccess.Variable> datapool = new TreeMap< String, DataAccess.Variable>(); String name = "thename"; DataAccess.Variable variable = new DataAccess.Variable('O', name, anyInstance); datapool.put(variable);This datapool can be used to access with
DataAccess#getData(List, Object, Map, boolean, boolean)
.Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<? extends T> |
clazz
A Class which should be base class of the value.
|
protected boolean |
isConst
Property whether this variable should be non-changeable (true) or changeable (false).
|
protected java.lang.String |
name
Same name of the variable like it is stored in the container.
|
protected char |
type
Type of the variable.
|
protected T |
value
Reference to the data.
|
Constructor and Description |
---|
Variable(char type,
java.lang.String name,
T value) |
Variable(char type,
java.lang.String name,
T value,
boolean isConst)
Creates a variable which's value is const or not.
|
Variable(DataAccess.Variable<T> src)
Builds a copy of this.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isConst() |
java.lang.String |
name() |
void |
setValue(T value) |
java.lang.String |
toString() |
char |
type()
Returns the type of the variable:
The type follows the
DataAccess.DatapathElement.whatisit on creation of the variable:
'A': A new Appendable variable
'C': A new Class variable
'E': A new environment variable
'F': ? |
T |
value() |
protected char type
type()
.protected java.lang.Class<? extends T> clazz
protected boolean isConst
DataAccess.createOrReplaceVariable(Map, String, char, Object, boolean)
.
It is prevented to change by a non-const value only.protected final java.lang.String name
protected T value
public Variable(char type, java.lang.String name, T value)
public Variable(char type, java.lang.String name, T value, boolean isConst)
type
- One of "SAPLFOEVC" see type()
name
- value
- isConst
- true then the value is const.public Variable(DataAccess.Variable<T> src)
src
- any variablepublic java.lang.String name()
public T value()
public char type()
DataAccess.DatapathElement.whatisit
on creation of the variable:
public boolean isConst()
public void setValue(T value)
public java.lang.String toString()
toString
in class java.lang.Object