public interface Namespace extends HolderFactory
Modifier and Type | Method and Description |
---|---|
void |
addNewVariable(String name,
Type type,
boolean isDefinedInExpression)
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. |
Namespace |
createChildNamespace(String name,
Collection<Field> fields,
Collection<?> initialValues,
InterpreterConfiguration configuration)
Creates new child namespace with this namespace as the parent.
|
InterpreterConfiguration |
getConfiguration()
Returns interpreter configurartion for this namespace.
|
Object |
getConstantValue(String moduleName,
String constantName)
Returns the value of the constant with the given name from a (imported)
module with a given module name.
|
long |
getContextId()
Returns context id.
|
String |
getEvaluationLevel()
Return evaluation level.
|
Object |
getExecutionContext() |
Type |
getFreeType(FreeType type)
Returns the value of given free type or null if it does not exist in this context.
|
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.
|
Collection<String> |
getModuleNames()
Returns collection of all module names.
|
Namespace |
getModuleNamespace(String name)
Returns module namespace by its module name or
null if it does not exist. |
String |
getName()
Returns name of this namespace.
|
Namespace |
getNamespaceInLevel(String evaluationLevel)
Returns namespace in evaluation level.
|
NamespaceModel |
getNamespaceModel()
Returns
NamespaceModel for this namespace. |
Namespace |
getParentNamespace()
Returns parent namespace or
null if this is top namespace. |
QID |
getPathQID()
Returns
QID of the context path. |
RecordHolder |
getThis()
Returns object that represents this.
|
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 |
remove()
INTERNAL API.
|
RecordType |
resolveRecordType(String type)
Resolves record type and returns its type.
|
Type |
resolveType(String type)
Resolves type.
|
void |
setFreeType(FreeType type,
Type value)
Sets value for given free type.
|
void |
setPerformReadOnlyCheck(boolean performReadOnlyCheck)
Allows to enable/disable checking assignment to read only variables.
|
void |
setVariableValue(String name,
Object value)
Sets value of variable for given name from this namespace.
|
createBinaryHolder, createBinaryHolder, createClosure, createClosure, createClosure, createClosureFromExpression, createExternalRecordProxy, createList, createMap, createNonSharedRecord, createRange, createRecord, createRecord, createRecord, createRecord, createReference, createSet
String getName()
null
and does not have to be
unique. Multiple namespaces can share same name.Namespace getParentNamespace()
null
if this is top namespace.Namespace getModuleNamespace(String name)
null
if it does not exist.name
- Collection<String> getModuleNames()
boolean containsVariable(String name)
true
if this namespace contains variable of given name.name
- variable nameSet<String> getVariableNames()
Object getVariableValue(String name)
Null
is returned
if this namespace does not contain given variable.name
- variable namevoid setVariableValue(String name, Object value)
name
- variable namevalue
- new variable valueIllegalArgumentException
- if variable for given name does not exist in this namespace or if the value
cannot be assigned to the variable because of validation errorsType getVariableType(String name)
name
- variable nameObject getConstantValue(String moduleName, String constantName)
moduleName
- constantName
- null
if there is no such a constantHolderFactory getHolderFactory()
HolderFactory
. This can be used to create different runtime
objects.HolderFactory
Namespace createChildNamespace(String name, Collection<Field> fields, Collection<?> initialValues, InterpreterConfiguration configuration)
fields
.name
- the namespace namefields
- initialValues
- configuration
- NullPointerException
- if name
or fields
is nullIllegalArgumentException
- if fields
contains null elementvoid setFreeType(FreeType type, Type value)
type
- value
- NullPointerException
- if type
or value
is nullType getFreeType(FreeType type)
type
- NullPointerException
- if type
is nullvoid addNewVariable(String name, Type type, boolean isDefinedInExpression)
name
- type
- isDefinedInExpression
- InterpreterConfiguration getConfiguration()
boolean canBeInterpretedIn(InterpreterConfiguration configuration)
configuration
- Type resolveType(String type)
type
- NullPointerException
- if type
is nullIllegalArgumentException
- if no such type existsRecordType resolveRecordType(String type)
NamespaceModel.findNamedType(QID)
as follows:
final boolean recordExists = getNamespaceModel().findNamedType(QID.parse(type)) != null;
type
- fully qualified record type, not null.NullPointerException
- if type
is nullIllegalArgumentException
- if no such type exists or a type is not a record typevoid setPerformReadOnlyCheck(boolean performReadOnlyCheck)
performReadOnlyCheck
- Namespace getNamespaceInLevel(String evaluationLevel)
evaluationLevel
- Namespace getLowerLevelNamespace()
String getEvaluationLevel()
long getModelId()
long getModelInstanceId()
long getContextId()
NamespaceModel getNamespaceModel()
NamespaceModel
for this namespace.NamespaceModel
for this namespaceString getModelElementId()
RecordHolder getThis()
Object getJavaObject()
Object getExecutionContext()
void remove()
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.