public abstract class AbstractMockNamespace extends Object implements Namespace, JavaOperationExecutor
Constructor and Description |
---|
AbstractMockNamespace(String name)
Creates new instance of
AbstractMockNamespace . |
Modifier and Type | Method and Description |
---|---|
void |
addNewVariable(String name,
Type type,
boolean isExpressionLocal,
boolean readOnly)
Adds a new variable.
|
boolean |
canBeInterpretedIn(InterpreterConfiguration configuration)
Returns true if interpretation with given configuration can be done on this namespace.
|
boolean |
containsVariable(String name)
Returns
true if this namespace contains variable of given name. |
BinaryHolder |
createBinaryHolder(byte[] data)
Creates binary data holder.
|
BinaryHolder |
createBinaryHolder(String datasourceJndi,
String recordType,
String primaryKeyString,
String propertyName,
Blob data)
Creates binary data holder.
|
Namespace |
createChildNamespace(String name,
List<? extends Field> fields,
List<?> initialValues,
Map<FreeType,Type> freeTypeMapping,
InterpreterConfiguration configuration) |
ClosureHolder |
createClosure(ClosureType closureType,
ClosureExpression closureExpression,
ClosureOrigin origin)
Creates new closure corresponding to given closure expression.
|
ClosureHolder |
createClosure(ClosureType closureType,
FunctionExpression operationExpression,
ClosureOrigin origin)
Creates new closure corresponding to given operation expression.
|
ClosureHolder |
createClosure(ClosureType closureType,
MethodExpression operationExpression,
ClosureOrigin origin)
Creates new closure corresponding to given operation expression.
|
ClosureHolder |
createClosureFromExpression(ClosureType closureType,
Expression expression,
ClosureOrigin origin)
Creates new closure from a given expression.
|
RecordHolder |
createExternalRecordProxy(RecordType type,
RecordHolder proxySet)
Creates a proxy without proxied record.
|
ListHolder |
createList(Collection<?> values)
Creates new list with given values (
ListHolder s are immutable). |
MapHolder |
createMap(List<?> keys,
List<?> values)
Creates new map with given values (
MapHolder s are immutable). |
MapHolder |
createMap(Map<?,?> values)
Creates new map with given values (
MapHolder s are immutable). |
RecordHolder |
createNonSharedRecord(RecordType type,
Map<String,?> values)
Creates new record of given type.
|
ListHolder |
createRange(long first,
long last)
Creates a range (list) defined by endpoints (both inclusive).
|
RecordHolder |
createRecord(RecordType type,
Map<String,?> values)
Creates new record with given type.
|
RecordHolder |
createRecord(String type,
Map<String,?> values)
Creates new record with given type.
|
ReferenceHolder |
createReference(ReferenceType referenceType,
ReferenceExpression referenceExpression,
List<Property> properties,
ClosureOrigin origin)
Returns new reference corresponding to given reference expression.
|
SetHolder |
createSet(Collection<?> values)
Creates new set with given values (
SetHolder s are immutable). |
Object |
executeJavaOperation(String className,
String methodName,
Class<?>[] argClasses,
Object[] evaluatedArgs,
InterpreterStackTrace stackTrace)
Executes the operation.
|
Object |
getCompiled() |
Object |
getCompiled(String moduleName) |
InterpreterConfiguration |
getConfiguration()
Returns interpreter configurartion for this namespace.
|
long |
getContextId()
Returns context id.
|
String |
getEvaluationLevel()
Return evaluation level.
|
Object |
getExecutionContext() |
HolderFactory |
getHolderFactory()
Returns an instance of
HolderFactory . |
Object |
getJavaObject()
Returns underlying java object if there is some.
|
Namespace |
getLowerLevelNamespace()
Returns namespace corresponding to this namespace on lower level.
|
String |
getModelElementId()
Returns id of model element that is related to this namespace.
|
long |
getModelId()
Returns model id.
|
long |
getModelInstanceId()
Returns model instance id.
|
String |
getName()
Returns name of this namespace.
|
Namespace |
getNamespaceInLevel(String evaluationLevel)
Returns namespace in evaluation level.
|
QID |
getPathQID()
Returns
QID of the context path. |
Set<String> |
getVariableNames()
Returns the names of all the variables.
|
Type |
getVariableType(String name)
Returns the type of variable or null if it does not exist.
|
Object |
getVariableValue(String name)
Returns value of variable for given name from this namespace.
|
void |
initializeVariable(String name,
Object value)
Sets the initial value of a variable.
|
boolean |
isVariableReadOnly(String name)
Returns
true if the variable with a given name is read-only. |
void |
remove()
INTERNAL API.
|
void |
setCompiled(Object compiled) |
void |
setVariableValue(String name,
Object value)
Sets value of variable for given name from this namespace.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addNewVariable, createChildNamespace, getAllFreeTypeNames, getConstantValue, getFreeType, getFreeTypeMapping, getModuleNames, getModuleNamespace, getNamespaceModel, getParentNamespace, getThis, getTopNamespace, resolveRecordType, resolveType
createRecord, createRecord
public AbstractMockNamespace(String name)
AbstractMockNamespace
.name
- public boolean containsVariable(String name)
Namespace
true
if this namespace contains variable of given name.containsVariable
in interface Namespace
name
- variable namepublic String getName()
Namespace
null
and does not have to be
unique. Multiple namespaces can share same name.public Type getVariableType(String name)
Namespace
getVariableType
in interface Namespace
name
- variable namepublic Object getVariableValue(String name)
Namespace
Null
is returned
if this namespace does not contain given variable.getVariableValue
in interface Namespace
name
- variable namepublic void setVariableValue(String name, Object value)
Namespace
setVariableValue
in interface Namespace
name
- variable namevalue
- new variable valuepublic void initializeVariable(String name, Object value)
Namespace
initializeVariable
in interface Namespace
public boolean isVariableReadOnly(String name)
Namespace
true
if the variable with a given name is read-only.isVariableReadOnly
in interface Namespace
true
if the variable is read-onlypublic Namespace createChildNamespace(String name, List<? extends Field> fields, List<?> initialValues, Map<FreeType,Type> freeTypeMapping, InterpreterConfiguration configuration)
createChildNamespace
in interface Namespace
public Set<String> getVariableNames()
Namespace
getVariableNames
in interface Namespace
public void addNewVariable(String name, Type type, boolean isExpressionLocal, boolean readOnly)
Namespace
addNewVariable
in interface Namespace
public InterpreterConfiguration getConfiguration()
Namespace
getConfiguration
in interface Namespace
public boolean canBeInterpretedIn(InterpreterConfiguration configuration)
Namespace
canBeInterpretedIn
in interface Namespace
public Namespace getNamespaceInLevel(String evaluationLevel)
Namespace
getNamespaceInLevel
in interface Namespace
public long getModelId()
Namespace
getModelId
in interface Namespace
public long getModelInstanceId()
Namespace
getModelInstanceId
in interface Namespace
public long getContextId()
Namespace
getContextId
in interface Namespace
public Namespace getLowerLevelNamespace()
Namespace
getLowerLevelNamespace
in interface Namespace
public String getEvaluationLevel()
Namespace
getEvaluationLevel
in interface Namespace
public String getModelElementId()
Namespace
getModelElementId
in interface Namespace
public QID getPathQID()
Namespace
QID
of the context path.getPathQID
in interface Namespace
QID
of the context pathpublic Object getJavaObject()
Namespace
getJavaObject
in interface Namespace
public Object getExecutionContext()
getExecutionContext
in interface Namespace
public Object executeJavaOperation(String className, String methodName, Class<?>[] argClasses, Object[] evaluatedArgs, InterpreterStackTrace stackTrace) throws ErrorException
JavaOperationExecutor
executeJavaOperation
in interface JavaOperationExecutor
stackTrace
- a stack traceErrorException
- the error exceptionpublic void remove()
Namespace
public Object getCompiled()
getCompiled
in interface Namespace
public void setCompiled(Object compiled)
setCompiled
in interface Namespace
public Object getCompiled(String moduleName)
getCompiled
in interface Namespace
public HolderFactory getHolderFactory()
Namespace
HolderFactory
. This can be used to create different runtime
objects.getHolderFactory
in interface Namespace
HolderFactory
public RecordHolder createExternalRecordProxy(RecordType type, RecordHolder proxySet)
HolderFactory
createExternalRecordProxy
in interface HolderFactory
public RecordHolder createRecord(RecordType type, Map<String,?> values)
HolderFactory
createRecord
in interface HolderFactory
values
- initial record field valuespublic RecordHolder createNonSharedRecord(RecordType type, Map<String,?> values)
HolderFactory
createNonSharedRecord
in interface HolderFactory
values
- initial record field valuespublic RecordHolder createRecord(String type, Map<String,?> values)
HolderFactory
createRecord
in interface HolderFactory
values
- initial record field valuesRecordType
public ListHolder createList(Collection<?> values)
HolderFactory
ListHolder
s are immutable).
The type is inferred from the types of the values.createList
in interface HolderFactory
public ListHolder createRange(long first, long last)
HolderFactory
If first <= last
, the range contains elements first, first + 1, ..., last
.
If first > last
, the range contains elements first, first - 1, ..., last
.
The memory footprint of range in constant (only endpoints and size is stored, not all elements).
createRange
in interface HolderFactory
public SetHolder createSet(Collection<?> values)
HolderFactory
SetHolder
s are immutable). The
type is inferred from the types of the values.createSet
in interface HolderFactory
public MapHolder createMap(List<?> keys, List<?> values)
HolderFactory
MapHolder
s are immutable). The
type is inferred from the types of the values.createMap
in interface HolderFactory
keys
- a list of keysvalues
- a list of valuespublic MapHolder createMap(Map<?,?> values)
HolderFactory
MapHolder
s are immutable). The
type is inferred from the types of the values.createMap
in interface HolderFactory
public ClosureHolder createClosure(ClosureType closureType, ClosureExpression closureExpression, ClosureOrigin origin)
HolderFactory
createClosure
in interface HolderFactory
public ClosureHolder createClosureFromExpression(ClosureType closureType, Expression expression, ClosureOrigin origin)
HolderFactory
createClosureFromExpression
in interface HolderFactory
public ClosureHolder createClosure(ClosureType closureType, FunctionExpression operationExpression, ClosureOrigin origin)
HolderFactory
createClosure
in interface HolderFactory
public ClosureHolder createClosure(ClosureType closureType, MethodExpression operationExpression, ClosureOrigin origin)
HolderFactory
createClosure
in interface HolderFactory
public ReferenceHolder createReference(ReferenceType referenceType, ReferenceExpression referenceExpression, List<Property> properties, ClosureOrigin origin)
HolderFactory
createReference
in interface HolderFactory
public BinaryHolder createBinaryHolder(byte[] data)
HolderFactory
createBinaryHolder
in interface HolderFactory
public BinaryHolder createBinaryHolder(String datasourceJndi, String recordType, String primaryKeyString, String propertyName, Blob data)
HolderFactory
createBinaryHolder
in interface HolderFactory
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.