public class BasicModule extends AbstractNamespace implements Module
Module
Constructor and Description |
---|
BasicModule(String name)
Creates new instance.
|
BasicModule(String name,
Collection<? extends Module> imports)
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addConstant(ConstantInfo constantInfo)
Adds a constant.
|
void |
addReferencedOperation(ReferencedOperation operation)
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.
|
Map<String,Module> |
allImportedModules()
Returns an immutable map of all imports.
|
BasicModule |
copyStatic()
Creates a new basic module with same types, functions, constants, but
variables are not copied.
|
NamedClassType |
getClassType(String name)
Returns a class type defined in this module with a given name.
|
Collection<NamedClassType> |
getClassTypes()
Returns class types, declared in this Module
|
ConstantInfo |
getConstant(String name)
Returns a constant declared in this module.
|
Collection<ConstantInfo> |
getConstants()
Returns a collection of constants declared in this module.
|
Object |
getConstantValue(String name)
Returns the constant value.
|
Collection<EnumerationType> |
getEnumerationTypes()
Returns a collection of enumeration types declared in this module.
|
Collection<InterfaceType> |
getInterfaceTypes()
Returns interface types, declared in this Module
|
Collection<FunctionSignature> |
getLocalSignaturesForName(String name)
Returns the local function signatures for given name.
|
Module |
getModule()
Returns the enclosing module.
|
Collection<NamedType> |
getNamedTypes()
Returns a collection of named types (records, enumerations etc.) declared
in this module.
|
NamespaceModel |
getParent()
Returns the parent namespace or null.
|
Collection<RecordType> |
getRecordTypes()
Returns record types, declared in this Module
|
ReferencedOperation |
getReferencedOperation(String id)
Returns operation for the id.
|
Collection<FunctionSignature> |
getSignatures()
Returns function signatures defined in this namespace.
|
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.
|
protected Map<String,Module> |
importedModules()
Returns an immutable map of imports.
|
boolean |
isModule()
Returns true if this is a module.
|
void |
registerEnumeration(EnumerationType type)
Registers an enumeration type.
|
void |
registerInterfaceType(InterfaceType type)
Registers given interface type, that is declared in this Module
|
void |
registerRecordType(RecordType type)
Registers given record type, that is declared in this Module
|
void |
setConstantValue(String name,
Object value)
Sets the constant value.
|
addModules, addVariable, addVariable, addVariable, addVariable, findNamedType, getAllImportedModules, getAlternativeName, getCompiled, getConstants, getExtensionMethods, getExtensionMethods, getImportedModuleByName, getImportedModules, getName, getSignatures, getSignaturesForName, getSignaturesForName, getSignaturesForNamedArgs, getVariable, getVariable, getVariablePrivacy, getVariables, getVariables, getVisibleConstants, getVisibleNamedTypes, getVisibleRecordTypes, getVisibleSignatures, getVisibleVariables, setAlternativeName, setCompiled, toString, validateIdentifier
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addVariable, addVariable, addVariable, addVariable, findNamedType, getAllImportedModules, getAlternativeName, getCompiled, getConstants, getExtensionMethods, getExtensionMethods, getImportedModuleByName, getImportedModules, getName, getSignatures, getSignaturesForName, getSignaturesForName, getSignaturesForNamedArgs, getVariable, getVariable, getVariablePrivacy, getVariables, getVariables, getVisibleConstants, getVisibleNamedTypes, getVisibleRecordTypes, getVisibleSignatures, getVisibleVariables, setAlternativeName, setCompiled, validateIdentifier
public BasicModule(String name)
name
- the namepublic BasicModule(String name, Collection<? extends Module> imports)
name
- the nameimports
- the importsprotected Map<String,Module> importedModules()
AbstractNamespace
importedModules
in class AbstractNamespace
public Map<String,Module> allImportedModules()
AbstractNamespace
allImportedModules
in class AbstractNamespace
public NamedType getTypeForName(String typeName)
NamespaceModel
getTypeForName
in interface NamespaceModel
public NamedClassType getClassType(String name)
Module
getClassType
in interface Module
public Collection<NamedClassType> getClassTypes()
Module
getClassTypes
in interface Module
public Collection<RecordType> getRecordTypes()
Module
getRecordTypes
in interface Module
public void registerRecordType(RecordType type)
Module
registerRecordType
in interface Module
public void registerInterfaceType(InterfaceType type)
Module
registerInterfaceType
in interface Module
public Collection<InterfaceType> getInterfaceTypes()
Module
getInterfaceTypes
in interface Module
public void registerEnumeration(EnumerationType type)
Module
registerEnumeration
in interface Module
public Collection<EnumerationType> getEnumerationTypes()
Module
getEnumerationTypes
in interface Module
public Collection<NamedType> getNamedTypes()
Module
getNamedTypes
in interface Module
public NamespaceModel getParent()
NamespaceModel
getParent
in interface NamespaceModel
public void addSignature(FunctionSignature signature)
NamespaceModel
addSignature
in interface NamespaceModel
signature
- function signature to be registered in this namespacepublic final Collection<FunctionSignature> getSignatures()
NamespaceModel
getSignatures
in interface NamespaceModel
public Collection<FunctionSignature> getLocalSignaturesForName(String name)
NamespaceModel
getLocalSignaturesForName
in interface NamespaceModel
public Module getModule()
NamespaceModel
getModule
in interface NamespaceModel
public boolean isModule()
NamespaceModel
isModule
in interface NamespaceModel
public void addConstant(ConstantInfo constantInfo)
Module
addConstant
in interface Module
public ConstantInfo getConstant(String name)
Module
getConstant
in interface Module
null
if there is no constant with a given namepublic Object getConstantValue(String name)
Module
getConstantValue
in interface Module
public void setConstantValue(String name, Object value)
Module
setConstantValue
in interface Module
public Collection<ConstantInfo> getConstants()
Module
getConstants
in interface Module
public void addReferencedOperation(ReferencedOperation operation)
NamespaceModel
addReferencedOperation
in interface NamespaceModel
public ReferencedOperation getReferencedOperation(String id)
NamespaceModel
getReferencedOperation
in interface NamespaceModel
public BasicModule copyStatic()
public ClassType getThisType()
NamespaceModel
getThisType
in interface NamespaceModel
public ClassType getStaticType()
NamespaceModel
getStaticType
in interface NamespaceModel
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.