public interface Namespace extends HolderFactory, FreeTypeMapping
| Modifier and Type | Method and Description |
|---|---|
default void |
addNewVariable(java.lang.String name,
Type type,
boolean isDefinedInExpression)
Adds a new variable.
|
void |
addNewVariable(java.lang.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(java.lang.String name)
Returns
true if this namespace contains variable of given name. |
default Namespace |
createChildNamespace(java.lang.String name,
java.util.List<? extends Field> fields,
java.util.List<?> initialValues,
InterpreterConfiguration configuration)
Creates new child namespace with this namespace as the parent.
|
Namespace |
createChildNamespace(java.lang.String name,
java.util.List<? extends Field> fields,
java.util.List<?> initialValues,
java.util.Map<FreeType,Type> freeTypeMapping,
InterpreterConfiguration configuration) |
java.util.Set<java.lang.String> |
getAllFreeTypeNames()
Returns all free type names.
|
java.lang.Object |
getCompiled() |
java.lang.Object |
getCompiled(java.lang.String moduleName) |
InterpreterConfiguration |
getConfiguration()
Returns interpreter configurartion for this namespace.
|
java.lang.Object |
getConstantValue(java.lang.String moduleName,
java.lang.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.
|
java.lang.String |
getEvaluationLevel()
Return evaluation level.
|
java.lang.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. |
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.util.Collection<java.lang.String> |
getModuleNames()
Returns collection of all module names.
|
Namespace |
getModuleNamespace(java.lang.String name)
Returns module namespace by its module name or
null if it does not exist. |
java.lang.String |
getName()
Returns name of this namespace.
|
Namespace |
getNamespaceInLevel(java.lang.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.
|
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.
|
default RecordType |
resolveRecordType(java.lang.String type)
Resolves record type and returns its type.
|
Type |
resolveType(java.lang.String type)
Resolves type.
|
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.
|
createBinaryHolder, createBinaryHolder, createClosure, createClosure, createClosure, createClosureFromExpression, createExternalRecordProxy, createList, createMap, createMap, createNonSharedRecord, createRange, createRecord, createRecord, createRecord, createRecord, createReference, createSetjava.lang.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(java.lang.String name)
null if it does not exist.name - java.util.Collection<java.lang.String> getModuleNames()
boolean containsVariable(java.lang.String name)
true if this namespace contains variable of given name.name - variable namejava.util.Set<java.lang.String> getVariableNames()
java.lang.Object getVariableValue(java.lang.String name)
Null is returned
if this namespace does not contain given variable.name - variable namevoid setVariableValue(java.lang.String name,
java.lang.Object value)
name - variable namevalue - new variable valuejava.lang.IllegalArgumentException - 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(java.lang.String name,
java.lang.Object value)
name - value - java.lang.IllegalStateException - if the variable is already initializedType getVariableType(java.lang.String name)
name - variable nameboolean isVariableReadOnly(java.lang.String name)
true if the variable with a given name is read-only.name - true if the variable is read-onlyjava.lang.Object getConstantValue(java.lang.String moduleName,
java.lang.String constantName)
moduleName - constantName - null if there is no such a constantHolderFactory getHolderFactory()
HolderFactory. This can be used to create different runtime
objects.HolderFactorydefault Namespace createChildNamespace(java.lang.String name, java.util.List<? extends Field> fields, java.util.List<?> initialValues, InterpreterConfiguration configuration)
fields.name - the namespace namefields - initialValues - configuration - java.lang.NullPointerException - if name or fields is nulljava.lang.IllegalArgumentException - if fields contains null elementNamespace createChildNamespace(java.lang.String name, java.util.List<? extends Field> fields, java.util.List<?> initialValues, java.util.Map<FreeType,Type> freeTypeMapping, InterpreterConfiguration configuration)
name - fields - initialValues - freeTypeMapping - configuration - Type getFreeType(FreeType type)
type - java.lang.NullPointerException - if type is nulljava.util.Set<java.lang.String> getAllFreeTypeNames()
default Type getFreeTypeMapping(FreeType freeType)
FreeTypeMappinggetFreeTypeMapping in interface FreeTypeMappingdefault void addNewVariable(java.lang.String name,
Type type,
boolean isDefinedInExpression)
name - type - isDefinedInExpression - void addNewVariable(java.lang.String name,
Type type,
boolean isDefinedInExpression,
boolean readOnly)
name - type - isDefinedInExpression - readOnly - InterpreterConfiguration getConfiguration()
boolean canBeInterpretedIn(InterpreterConfiguration configuration)
configuration - Type resolveType(java.lang.String type)
type - java.lang.NullPointerException - if type is nulljava.lang.IllegalArgumentException - if no such type existsdefault RecordType resolveRecordType(java.lang.String type)
NamespaceModel.findNamedType(QID) as follows:
final boolean recordExists = getNamespaceModel().findNamedType(QID.parse(type)) != null;
type - fully qualified record type, not null.java.lang.NullPointerException - if type is nulljava.lang.IllegalArgumentException - if no such type exists or a type is not a record typeNamespace getNamespaceInLevel(java.lang.String evaluationLevel)
evaluationLevel - Namespace getLowerLevelNamespace()
java.lang.String getEvaluationLevel()
long getModelId()
long getModelInstanceId()
long getContextId()
NamespaceModel getNamespaceModel()
NamespaceModel for this namespace.NamespaceModel for this namespacejava.lang.String getModelElementId()
RecordHolder getThis()
java.lang.Object getJavaObject()
java.lang.Object getExecutionContext()
void remove()
java.lang.Object getCompiled()
java.lang.Object getCompiled(java.lang.String moduleName)
void setCompiled(java.lang.Object compiled)
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.