public abstract class AbstractNamespace extends Object implements NamespaceModel
Modifier | Constructor and Description |
---|---|
protected |
AbstractNamespace(String name)
Creates a new namespace with given name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addModules(Collection<? extends Module> modules,
Map<String,Module> map,
boolean transitive)
Adds modules to a map.
|
void |
addVariable(String variableName,
Type variableType)
Registers a public variable in this namespace.
|
void |
addVariable(String variableName,
Type variableType,
boolean isPrivate)
Registers a variable in this namespace.
|
void |
addVariable(String variableName,
Type variableType,
boolean isPrivate,
boolean isReadOnly)
Registers a variable in this namespace.
|
void |
addVariable(VariableInfo variable)
Registers the given variable in this namespace.
|
abstract Map<String,Module> |
allImportedModules()
Returns an immutable map of all imports.
|
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.
|
String |
getName()
Returns the name of defined type, which is unique in the module.
|
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.
|
VariableInfo |
getVariable(String variableName)
Returns a local variable for the given name.
|
VariableInfo |
getVariable(String variableName,
boolean includePrivate)
Returns a local variable info for the given name.
|
boolean |
getVariablePrivacy(String variableName)
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.
|
protected abstract Map<String,Module> |
importedModules()
Returns an immutable map of imports.
|
void |
setAlternativeName(String alternativeName)
Sets alternative name.
|
void |
setCompiled(Constructor<?> constructor)
Sets constructor of class that was generated by compilation to java for this namespace model.
|
String |
toString() |
boolean |
validateIdentifier(String identifierName)
Returns true if name is valid identifier according the used language.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addReferencedOperation, addSignature, getLocalSignaturesForName, getModule, getParent, getReferencedOperation, getSignatures, getStaticType, getThisType, getTypeForName, isModule
protected AbstractNamespace(String name)
name
- string containing name for the new namespacepublic void addVariable(String variableName, Type variableType)
NamespaceModel
addVariable
in interface NamespaceModel
variableName
- string containing the name of the variablevariableType
- type of the variablepublic void addVariable(String variableName, Type variableType, boolean isPrivate)
NamespaceModel
addVariable
in interface NamespaceModel
variableName
- string containing the name of the variablevariableType
- type of the variableisPrivate
- true if the variable is private, false if it is publicpublic void addVariable(String variableName, Type variableType, boolean isPrivate, boolean isReadOnly)
NamespaceModel
addVariable
in interface NamespaceModel
variableName
- string containing the name of the variablevariableType
- type of the variableisPrivate
- true if the variable is private, false if it is publicisReadOnly
- true if the variable is read-only, false otherwisepublic void addVariable(VariableInfo variable)
NamespaceModel
addVariable
in interface NamespaceModel
public boolean validateIdentifier(String identifierName)
validateIdentifier
in interface NamespaceModel
identifierName
- string containing the proposed identifierpublic VariableInfo getVariable(String variableName)
NamespaceModel
getVariable
in interface NamespaceModel
null
public boolean getVariablePrivacy(String variableName)
NamespaceModel
getVariablePrivacy
in interface NamespaceModel
public final VariableInfo getVariable(String variableName, boolean includePrivate)
NamespaceModel
getVariable
in interface NamespaceModel
includePrivate
- true if also private variable can be returned, false if only publicpublic Collection<VariableInfo> getVariables(QID name)
NamespaceModel
getVariables
in interface NamespaceModel
public Collection<ConstantInfo> getConstants(QID name)
NamespaceModel
getConstants
in interface NamespaceModel
public Collection<VariableInfo> getVariables()
NamespaceModel
getVariables
in interface NamespaceModel
public Collection<SignatureMapping> getSignaturesForName(QID name)
NamespaceModel
getSignaturesForName
in interface NamespaceModel
public Collection<SignatureMapping> getSignaturesForName(QID name, ClosureType type)
NamespaceModel
getSignaturesForName
in interface NamespaceModel
public Collection<SignatureMapping> getSignaturesForNamedArgs(QID name, Map<String,Type> args, Type returnType)
NamespaceModel
getSignaturesForNamedArgs
in interface NamespaceModel
public Collection<SignatureMapping> getSignatures(String namePattern, List<? extends Type> args, Type returnType, Map<String,String> metadataPattern)
NamespaceModel
getSignatures
in interface NamespaceModel
namePattern
- regular expressionmetadataPattern
- map with required metadata, values are regular expressions.public Collection<SignatureMapping> getExtensionMethods(Type type, String methodName)
NamespaceModel
getExtensionMethods
in interface NamespaceModel
public Collection<SignatureMapping> getExtensionMethods(Type type)
NamespaceModel
getExtensionMethods
in interface NamespaceModel
protected abstract Map<String,Module> importedModules()
public abstract Map<String,Module> allImportedModules()
protected void addModules(Collection<? extends Module> modules, Map<String,Module> map, boolean transitive)
modules
- map
- transitive
- public Collection<Module> getImportedModules()
NamespaceModel
getImportedModules
in interface NamespaceModel
public Collection<Module> getAllImportedModules()
NamespaceModel
getAllImportedModules
in interface NamespaceModel
public Module getImportedModuleByName(String moduleName)
NamespaceModel
getImportedModuleByName
in interface NamespaceModel
public String getName()
NamespaceModel
getName
in interface NamespaceModel
public Collection<RecordType> getVisibleRecordTypes()
NamespaceModel
getVisibleRecordTypes
in interface NamespaceModel
public Collection<NamedType> getVisibleNamedTypes()
NamespaceModel
getVisibleNamedTypes
in interface NamespaceModel
public Collection<FunctionSignature> getVisibleSignatures()
NamespaceModel
getVisibleSignatures
in interface NamespaceModel
public Collection<VariableInfo> getVisibleVariables()
NamespaceModel
getVisibleVariables
in interface NamespaceModel
public String getAlternativeName()
NamespaceModel
getAlternativeName
in interface NamespaceModel
public void setAlternativeName(String alternativeName)
NamespaceModel
setAlternativeName
in interface NamespaceModel
public Collection<ConstantInfo> getVisibleConstants()
NamespaceModel
getVisibleConstants
in interface NamespaceModel
public NamedType findNamedType(QID qid) throws AmbiguousTypeException
NamespaceModel
findNamedType
in interface NamespaceModel
qid
- the type name, not null.null
if not foundAmbiguousTypeException
public Constructor<?> getCompiled()
NamespaceModel
Namespace
getCompiled
in interface NamespaceModel
public void setCompiled(Constructor<?> constructor)
NamespaceModel
Namespace
setCompiled
in interface NamespaceModel
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.