public abstract class AbstractMockNamespace extends java.lang.Object implements Namespace, JavaOperationExecutor
| Constructor and Description |
|---|
AbstractMockNamespace(java.lang.String name)
Creates new instance of
AbstractMockNamespace. |
| Modifier and Type | Method and Description |
|---|---|
void |
addNewVariable(java.lang.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(java.lang.String name)
Returns
true if this namespace contains variable of given name. |
BinaryHolder |
createBinaryHolder(byte[] data)
Creates binary data holder.
|
BinaryHolder |
createBinaryHolder(java.lang.String datasourceJndi,
java.lang.String recordType,
java.lang.String primaryKeyString,
java.lang.String propertyName,
java.sql.Blob data)
Creates binary data holder.
|
Namespace |
createChildNamespace(java.lang.String name,
java.util.List<? extends Field> fields,
java.util.List<?> initialValues,
java.util.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(java.util.Collection<?> values)
Creates new list with given values (
ListHolders are immutable). |
MapHolder |
createMap(java.util.List<?> keys,
java.util.List<?> values)
Creates new map with given values (
MapHolders are immutable). |
MapHolder |
createMap(java.util.Map<?,?> values)
Creates new map with given values (
MapHolders are immutable). |
RecordHolder |
createNonSharedRecord(RecordType type,
java.util.Map<java.lang.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,
java.util.Map<java.lang.String,?> values)
Creates new record with given type.
|
RecordHolder |
createRecord(java.lang.String type,
java.util.Map<java.lang.String,?> values)
Creates new record with given type.
|
ReferenceHolder |
createReference(ReferenceType referenceType,
ReferenceExpression referenceExpression,
java.util.List<Property> properties,
ClosureOrigin origin)
Returns new reference corresponding to given reference expression.
|
SetHolder |
createSet(java.util.Collection<?> values)
Creates new set with given values (
SetHolders are immutable). |
java.lang.Object |
executeJavaOperation(java.lang.String className,
java.lang.String methodName,
java.lang.Class<?>[] argClasses,
java.lang.Object[] evaluatedArgs,
InterpreterStackTrace stackTrace)
Executes the operation.
|
java.lang.Object |
getCompiled() |
java.lang.Object |
getCompiled(java.lang.String moduleName) |
InterpreterConfiguration |
getConfiguration()
Returns interpreter configurartion for this namespace.
|
long |
getContextId()
Returns context id.
|
java.lang.String |
getEvaluationLevel()
Return evaluation level.
|
java.lang.Object |
getExecutionContext() |
HolderFactory |
getHolderFactory()
Returns an instance of
HolderFactory. |
java.lang.Object |
getJavaObject()
Returns underlying java object if there is some.
|
Namespace |
getLowerLevelNamespace()
Returns namespace corresponding to this namespace on lower level.
|
java.lang.String |
getModelElementId()
Returns id of model element that is related to this namespace.
|
long |
getModelId()
Returns model id.
|
long |
getModelInstanceId()
Returns model instance id.
|
java.lang.String |
getName()
Returns name of this namespace.
|
Namespace |
getNamespaceInLevel(java.lang.String evaluationLevel)
Returns namespace in evaluation level.
|
QID |
getPathQID()
Returns
QID of the context path. |
java.util.Set<java.lang.String> |
getVariableNames()
Returns the names of all the variables.
|
Type |
getVariableType(java.lang.String name)
Returns the type of variable or null if it does not exist.
|
java.lang.Object |
getVariableValue(java.lang.String name)
Returns value of variable for given name from this namespace.
|
void |
initializeVariable(java.lang.String name,
java.lang.Object value)
Sets the initial value of a variable.
|
boolean |
isVariableReadOnly(java.lang.String name)
Returns
true if the variable with a given name is read-only. |
void |
remove()
INTERNAL API.
|
void |
setCompiled(java.lang.Object compiled) |
void |
setVariableValue(java.lang.String name,
java.lang.Object value)
Sets value of variable for given name from this namespace.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddNewVariable, createChildNamespace, getAllFreeTypeNames, getConstantValue, getFreeType, getFreeTypeMapping, getModuleNames, getModuleNamespace, getNamespaceModel, getParentNamespace, getThis, getTopNamespace, resolveRecordType, resolveTypecreateRecord, createRecordpublic AbstractMockNamespace(java.lang.String name)
AbstractMockNamespace.name - public java.lang.String toString()
toString in class java.lang.Objectpublic boolean containsVariable(java.lang.String name)
Namespacetrue if this namespace contains variable of given name.containsVariable in interface Namespacename - variable namepublic java.lang.String getName()
Namespacenull and does not have to be
unique. Multiple namespaces can share same name.public Type getVariableType(java.lang.String name)
NamespacegetVariableType in interface Namespacename - variable namepublic java.lang.Object getVariableValue(java.lang.String name)
NamespaceNull is returned
if this namespace does not contain given variable.getVariableValue in interface Namespacename - variable namepublic void setVariableValue(java.lang.String name,
java.lang.Object value)
NamespacesetVariableValue in interface Namespacename - variable namevalue - new variable valuepublic void initializeVariable(java.lang.String name,
java.lang.Object value)
NamespaceinitializeVariable in interface Namespacepublic boolean isVariableReadOnly(java.lang.String name)
Namespacetrue if the variable with a given name is read-only.isVariableReadOnly in interface Namespacetrue if the variable is read-onlypublic Namespace createChildNamespace(java.lang.String name, java.util.List<? extends Field> fields, java.util.List<?> initialValues, java.util.Map<FreeType,Type> freeTypeMapping, InterpreterConfiguration configuration)
createChildNamespace in interface Namespacepublic java.util.Set<java.lang.String> getVariableNames()
NamespacegetVariableNames in interface Namespacepublic void addNewVariable(java.lang.String name,
Type type,
boolean isExpressionLocal,
boolean readOnly)
NamespaceaddNewVariable in interface Namespacepublic InterpreterConfiguration getConfiguration()
NamespacegetConfiguration in interface Namespacepublic boolean canBeInterpretedIn(InterpreterConfiguration configuration)
NamespacecanBeInterpretedIn in interface Namespacepublic Namespace getNamespaceInLevel(java.lang.String evaluationLevel)
NamespacegetNamespaceInLevel in interface Namespacepublic long getModelId()
NamespacegetModelId in interface Namespacepublic long getModelInstanceId()
NamespacegetModelInstanceId in interface Namespacepublic long getContextId()
NamespacegetContextId in interface Namespacepublic Namespace getLowerLevelNamespace()
NamespacegetLowerLevelNamespace in interface Namespacepublic java.lang.String getEvaluationLevel()
NamespacegetEvaluationLevel in interface Namespacepublic java.lang.String getModelElementId()
NamespacegetModelElementId in interface Namespacepublic QID getPathQID()
NamespaceQID of the context path.getPathQID in interface NamespaceQID of the context pathpublic java.lang.Object getJavaObject()
NamespacegetJavaObject in interface Namespacepublic java.lang.Object getExecutionContext()
getExecutionContext in interface Namespacepublic java.lang.Object executeJavaOperation(java.lang.String className,
java.lang.String methodName,
java.lang.Class<?>[] argClasses,
java.lang.Object[] evaluatedArgs,
InterpreterStackTrace stackTrace)
throws ErrorException
JavaOperationExecutorexecuteJavaOperation in interface JavaOperationExecutorstackTrace - a stack traceErrorException - the error exceptionpublic void remove()
Namespacepublic java.lang.Object getCompiled()
getCompiled in interface Namespacepublic void setCompiled(java.lang.Object compiled)
setCompiled in interface Namespacepublic java.lang.Object getCompiled(java.lang.String moduleName)
getCompiled in interface Namespacepublic HolderFactory getHolderFactory()
NamespaceHolderFactory. This can be used to create different runtime
objects.getHolderFactory in interface NamespaceHolderFactorypublic RecordHolder createExternalRecordProxy(RecordType type, RecordHolder proxySet)
HolderFactorycreateExternalRecordProxy in interface HolderFactorypublic RecordHolder createRecord(RecordType type, java.util.Map<java.lang.String,?> values)
HolderFactorycreateRecord in interface HolderFactoryvalues - initial record field valuespublic RecordHolder createNonSharedRecord(RecordType type, java.util.Map<java.lang.String,?> values)
HolderFactorycreateNonSharedRecord in interface HolderFactoryvalues - initial record field valuespublic RecordHolder createRecord(java.lang.String type, java.util.Map<java.lang.String,?> values)
HolderFactorycreateRecord in interface HolderFactoryvalues - initial record field valuesRecordTypepublic ListHolder createList(java.util.Collection<?> values)
HolderFactoryListHolders are immutable).
The type is inferred from the types of the values.createList in interface HolderFactorypublic 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 HolderFactorypublic SetHolder createSet(java.util.Collection<?> values)
HolderFactorySetHolders are immutable). The
type is inferred from the types of the values.createSet in interface HolderFactorypublic MapHolder createMap(java.util.List<?> keys, java.util.List<?> values)
HolderFactoryMapHolders are immutable). The
type is inferred from the types of the values.createMap in interface HolderFactorykeys - a list of keysvalues - a list of valuespublic MapHolder createMap(java.util.Map<?,?> values)
HolderFactoryMapHolders are immutable). The
type is inferred from the types of the values.createMap in interface HolderFactorypublic ClosureHolder createClosure(ClosureType closureType, ClosureExpression closureExpression, ClosureOrigin origin)
HolderFactorycreateClosure in interface HolderFactorypublic ClosureHolder createClosureFromExpression(ClosureType closureType, Expression expression, ClosureOrigin origin)
HolderFactorycreateClosureFromExpression in interface HolderFactorypublic ClosureHolder createClosure(ClosureType closureType, FunctionExpression operationExpression, ClosureOrigin origin)
HolderFactorycreateClosure in interface HolderFactorypublic ClosureHolder createClosure(ClosureType closureType, MethodExpression operationExpression, ClosureOrigin origin)
HolderFactorycreateClosure in interface HolderFactorypublic ReferenceHolder createReference(ReferenceType referenceType, ReferenceExpression referenceExpression, java.util.List<Property> properties, ClosureOrigin origin)
HolderFactorycreateReference in interface HolderFactorypublic BinaryHolder createBinaryHolder(byte[] data)
HolderFactorycreateBinaryHolder in interface HolderFactorypublic BinaryHolder createBinaryHolder(java.lang.String datasourceJndi, java.lang.String recordType, java.lang.String primaryKeyString, java.lang.String propertyName, java.sql.Blob data)
HolderFactorycreateBinaryHolder in interface HolderFactoryCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.