public interface Namespace extends HolderFactory, FreeTypeMapping
Modifier and Type | Method and Description |
---|---|
default void |
addNewVariable(String name,
Type type,
boolean isDefinedInExpression)
Adds a new variable.
|
void |
addNewVariable(String name,
Type type,
boolean isDefinedInExpression,
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. |
default Namespace |
createChildNamespace(String name,
List<? extends Field> fields,
List<?> initialValues,
InterpreterConfiguration configuration)
Creates new child namespace with this namespace as the parent.
|
Namespace |
createChildNamespace(String name,
List<? extends Field> fields,
List<?> initialValues,
Map<FreeType,Type> freeTypeMapping,
InterpreterConfiguration configuration) |
Set<String> |
getAllFreeTypeNames()
Returns all free type names.
|
Object |
getCompiled() |
Object |
getCompiled(String moduleName) |
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.
|
default Type |
getFreeTypeMapping(FreeType freeType)
Returns the mapping of given free type.
|
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.
|
default Namespace |
getTopNamespace()
Returns the top namespace (i.e.
|
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.
|
default RecordType |
resolveRecordType(String type)
Resolves record type and returns its type.
|
Type |
resolveType(String type)
Resolves type.
|
void |
setCompiled(Object compiled) |
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, 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.default Namespace getTopNamespace()
null
parent).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 errorsvoid initializeVariable(String name, Object value)
name
- value
- IllegalStateException
- if the variable is already initializedType getVariableType(String name)
name
- variable nameboolean isVariableReadOnly(String name)
true
if the variable with a given name is read-only.name
- true
if the variable is read-onlyObject 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
default Namespace createChildNamespace(String name, List<? extends Field> fields, List<?> initialValues, InterpreterConfiguration configuration)
fields
.name
- the namespace namefields
- initialValues
- configuration
- NullPointerException
- if name
or fields
is nullIllegalArgumentException
- if fields
contains null elementNamespace createChildNamespace(String name, List<? extends Field> fields, List<?> initialValues, Map<FreeType,Type> freeTypeMapping, InterpreterConfiguration configuration)
name
- fields
- initialValues
- freeTypeMapping
- configuration
- Type getFreeType(FreeType type)
type
- NullPointerException
- if type
is nullSet<String> getAllFreeTypeNames()
default Type getFreeTypeMapping(FreeType freeType)
FreeTypeMapping
getFreeTypeMapping
in interface FreeTypeMapping
default void addNewVariable(String name, Type type, boolean isDefinedInExpression)
name
- type
- isDefinedInExpression
- void addNewVariable(String name, Type type, boolean isDefinedInExpression, boolean readOnly)
name
- type
- isDefinedInExpression
- readOnly
- InterpreterConfiguration getConfiguration()
boolean canBeInterpretedIn(InterpreterConfiguration configuration)
configuration
- Type resolveType(String type)
type
- NullPointerException
- if type
is nullIllegalArgumentException
- if no such type existsdefault RecordType 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 typeNamespace 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()
Object getCompiled()
void setCompiled(Object compiled)
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.