public interface NamespaceModel
Each model contains one global model namespace, and local namespaces for model elements (goals, plans). Also the model may include other models (libraries), which have their own namespaces.
Modifier and Type | Method and Description |
---|---|
void |
addReferencedOperation(ReferencedOperation refOper)
Adds referenced operation so that it can be referenced for expressions compiled to java.
|
void |
addSignature(FunctionSignature signature)
Registers a function signature in this namespace.
|
void |
addVariable(String name,
Type type)
Registers a public variable in this namespace.
|
void |
addVariable(String name,
Type type,
boolean isPrivate)
Registers a variable in this namespace.
|
void |
addVariable(String name,
Type type,
boolean isPrivate,
boolean isReadOnly)
Registers a variable in this namespace.
|
void |
addVariable(VariableInfo variable)
Registers the given variable in this namespace.
|
NamedType |
findNamedType(QID qid)
Find a named type.
|
Collection<Module> |
getAllImportedModules()
Returns this module and all imported modules along with their imported modules recursively.
|
String |
getAlternativeName()
Returns alternative name.
|
Constructor<?> |
getCompiled()
Returns constructor of class that was generated by compilation to java for this namespace model.
|
Collection<ConstantInfo> |
getConstants(QID name)
Returns a list of constants for the given fully qualified name.
|
Collection<SignatureMapping> |
getExtensionMethods(Type type)
Returns a collection of extension methods for a given type.
|
Collection<SignatureMapping> |
getExtensionMethods(Type type,
String methodName)
Returns a collection of extension methods for a given type and name.
|
Module |
getImportedModuleByName(String moduleName)
Returns a reachable imported module by its module name or null if no such module exists.
|
Collection<Module> |
getImportedModules()
Returns imported modules.
|
Collection<FunctionSignature> |
getLocalSignaturesForName(String name)
Returns the local function signatures for given name.
|
Module |
getModule()
Returns the enclosing module.
|
String |
getName()
Returns the name of defined type, which is unique in the module.
|
NamespaceModel |
getParent()
Returns the parent namespace or null.
|
ReferencedOperation |
getReferencedOperation(String id)
Returns operation for the id.
|
Collection<FunctionSignature> |
getSignatures()
Returns function signatures defined in this namespace.
|
Collection<SignatureMapping> |
getSignatures(String namePattern,
List<? extends Type> args,
Type returnType,
Map<String,String> metadataPattern)
Returns a collection of function signatures for the given parameters.
|
Collection<SignatureMapping> |
getSignaturesForName(QID name)
Returns a collection of function signatures for the given name.
|
Collection<SignatureMapping> |
getSignaturesForName(QID name,
ClosureType type)
Returns a collection of function signatures for the given name, argument
count and expected signature closure type.
|
Collection<SignatureMapping> |
getSignaturesForNamedArgs(QID name,
Map<String,Type> args,
Type returnType)
Returns a collection of function signatures for the given name, arguments
names and types and a return type.
|
ClassType |
getStaticType()
Returns type for this namespace used for static methods.
|
ClassType |
getThisType()
Returns type for this namespace.
|
NamedType |
getTypeForName(String typeName)
Returns registered named type corresponding to given name.
|
VariableInfo |
getVariable(String name)
Returns a local variable for the given name.
|
VariableInfo |
getVariable(String name,
boolean includePrivate)
Returns a local variable info for the given name.
|
boolean |
getVariablePrivacy(String name)
Returns a local variable privacy for the given name.
|
Collection<VariableInfo> |
getVariables()
Returns a collection of all variables in this namespace.
|
Collection<VariableInfo> |
getVariables(QID name)
Returns a list of variables for the given fully qualified name.
|
Collection<ConstantInfo> |
getVisibleConstants()
Returns a collection of all visible constants.
|
Collection<NamedType> |
getVisibleNamedTypes()
Returns a collection of all visible named types (records, enumerations etc.).
|
Collection<RecordType> |
getVisibleRecordTypes()
Returns a collection of all visible defined record types.
|
Collection<FunctionSignature> |
getVisibleSignatures()
Returns a collection of all visible function signatures.
|
Collection<VariableInfo> |
getVisibleVariables()
Returns a collection of all visible variables.
|
boolean |
isModule()
Returns true if this is a module.
|
void |
setAlternativeName(String name)
Sets alternative name.
|
void |
setCompiled(Constructor<?> constructor)
Sets constructor of class that was generated by compilation to java for this namespace model.
|
boolean |
validateIdentifier(String identifierName)
Returns true if given identifier name is valid.
|
String getName()
String getAlternativeName()
void setAlternativeName(String name)
name
- void addSignature(FunctionSignature signature)
signature
- function signature to be registered in this namespacevoid addVariable(String name, Type type)
name
- string containing the name of the variabletype
- type of the variablevoid addVariable(String name, Type type, boolean isPrivate)
name
- string containing the name of the variabletype
- type of the variableisPrivate
- true if the variable is private, false if it is publicvoid addVariable(String name, Type type, boolean isPrivate, boolean isReadOnly)
name
- string containing the name of the variabletype
- type of the variableisPrivate
- true if the variable is private, false if it is publicisReadOnly
- true if the variable is read-only, false otherwisevoid addVariable(VariableInfo variable)
variable
- Collection<VariableInfo> getVariables()
Collection<VariableInfo> getVisibleVariables()
Collection<ConstantInfo> getVisibleConstants()
boolean validateIdentifier(String identifierName)
identifierName
- NamedType getTypeForName(String typeName)
typeName
- Collection<RecordType> getVisibleRecordTypes()
Collection<NamedType> getVisibleNamedTypes()
VariableInfo getVariable(String name)
name
- null
boolean getVariablePrivacy(String name)
name
- VariableInfo getVariable(String name, boolean includePrivate)
name
- includePrivate
- true if also private variable can be returned, false if only publicCollection<VariableInfo> getVariables(QID name)
name
- Collection<ConstantInfo> getConstants(QID name)
name
- Collection<FunctionSignature> getSignatures()
Collection<FunctionSignature> getVisibleSignatures()
Collection<FunctionSignature> getLocalSignaturesForName(String name)
name
- Collection<SignatureMapping> getSignaturesForName(QID name)
name
- Collection<SignatureMapping> getSignaturesForName(QID name, ClosureType type)
name
- type
- Collection<SignatureMapping> getSignaturesForNamedArgs(QID name, Map<String,Type> args, Type returnType)
name
- args
- returnType
- Collection<SignatureMapping> getSignatures(String namePattern, List<? extends Type> args, Type returnType, Map<String,String> metadataPattern)
namePattern
- regular expressionargs
- returnType
- metadataPattern
- map with required metadata, values are regular expressions.Collection<SignatureMapping> getExtensionMethods(Type type, String methodName)
type
- methodName
- Collection<SignatureMapping> getExtensionMethods(Type type)
type
- NamespaceModel getParent()
Collection<Module> getImportedModules()
Module getImportedModuleByName(String moduleName)
moduleName
- Collection<Module> getAllImportedModules()
Module getModule()
boolean isModule()
ClassType getThisType()
ClassType getStaticType()
void addReferencedOperation(ReferencedOperation refOper)
refOper
- ReferencedOperation getReferencedOperation(String id)
id
- NamedType findNamedType(QID qid) throws AmbiguousTypeException
qid
- the type name, not null.null
if not foundAmbiguousTypeException
Constructor<?> getCompiled()
Namespace
void setCompiled(Constructor<?> constructor)
Namespace
constructor
- Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.