Class IvmlTypeResolver
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.configuration.IvmlTypeResolver
-
- All Implemented Interfaces:
ITypeResolver
public class IvmlTypeResolver extends java.lang.Object implements ITypeResolver
A type resolver for IVML models.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private IDirectTypeRegistryAccessaccessprivate java.util.Map<IDatatype,java.util.Set<Attribute>>attributesprivate java.util.Map<IDatatype,TypeDescriptor<?>>ivmlMapprivate static EASyLoggerFactory.EASyLoggerLOGGERprivate Projectprojectprivate static booleanSTATICprivate TypeRegistrytypeRegistry
-
Constructor Summary
Constructors Constructor Description IvmlTypeResolver(Project project, TypeRegistry typeRegistry)Creates an IVML type resolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddType(java.lang.String name, TypeDescriptor<?> type)Adds a type via a given name.private voidcacheVariable(DecisionVariableDeclaration var)Cache data about a variable.TypeRegistrygetTypeRegistry()Returns the type registry this resolver is registered with.booleanisKnown(java.lang.String name)Returns whether the given type is already known.(package private) TypeDescriptor<?>obtainType(IDatatype type)Obtains the VIL/VTL type for the giventype.TypeDescriptor<? extends IVilType>resolveInstantiator(java.lang.String name)Resolves an instantiator by its name.TypeDescriptor<?>resolveType(java.lang.String name, boolean addIfMissing)Resolves a type by its name.TypeDescriptor<?>resolveType(IDatatype type)Resolves a type by its IVML type.voidsetRegistryAccess(IDirectTypeRegistryAccess access)Set the direct access to the registry.
-
-
-
Field Detail
-
STATIC
private static final boolean STATIC
- See Also:
- Constant Field Values
-
LOGGER
private static final EASyLoggerFactory.EASyLogger LOGGER
-
access
private IDirectTypeRegistryAccess access
-
project
private Project project
-
typeRegistry
private TypeRegistry typeRegistry
-
ivmlMap
private java.util.Map<IDatatype,TypeDescriptor<?>> ivmlMap
-
-
Constructor Detail
-
IvmlTypeResolver
public IvmlTypeResolver(Project project, TypeRegistry typeRegistry)
Creates an IVML type resolver.- Parameters:
project- the IVML modeltypeRegistry- the type registry this resolver is working for
-
-
Method Detail
-
cacheVariable
private void cacheVariable(DecisionVariableDeclaration var)
Cache data about a variable.- Parameters:
var- the variable to be cached
-
resolveType
public TypeDescriptor<?> resolveType(java.lang.String name, boolean addIfMissing)
Description copied from interface:ITypeResolverResolves a type by its name.- Specified by:
resolveTypein interfaceITypeResolver- Parameters:
name- the name of the type to be resolvedaddIfMissing- whether dynamically adding (a fake) type for a missing type is allowed through this call- Returns:
- the resolved type (or null if
namecannot be resolved)
-
obtainType
TypeDescriptor<?> obtainType(IDatatype type) throws VilException
Obtains the VIL/VTL type for the giventype. Create the type descriptor dynamically if required.- Parameters:
type- the type to look for- Returns:
- the type descriptor
- Throws:
VilException- in case that creating the type descriptor fails
-
addType
void addType(java.lang.String name, TypeDescriptor<?> type)Adds a type via a given name.- Parameters:
name- the name of the typetype- the type to be registered
-
resolveInstantiator
public TypeDescriptor<? extends IVilType> resolveInstantiator(java.lang.String name)
Description copied from interface:ITypeResolverResolves an instantiator by its name.- Specified by:
resolveInstantiatorin interfaceITypeResolver- Parameters:
name- the name of the type to be resolved- Returns:
- the resolved instantiator type (or null if
namecannot be resolved)
-
isKnown
public boolean isKnown(java.lang.String name)
Returns whether the given type is already known.- Parameters:
name- the name of the type- Returns:
trueif the type is already known,falseelse
-
getTypeRegistry
public TypeRegistry getTypeRegistry()
Description copied from interface:ITypeResolverReturns the type registry this resolver is registered with.- Specified by:
getTypeRegistryin interfaceITypeResolver- Returns:
- the type registry
-
setRegistryAccess
public void setRegistryAccess(IDirectTypeRegistryAccess access)
Description copied from interface:ITypeResolverSet the direct access to the registry.- Specified by:
setRegistryAccessin interfaceITypeResolver- Parameters:
access- the access instance
-
resolveType
public TypeDescriptor<?> resolveType(IDatatype type)
Description copied from interface:ITypeResolverResolves a type by its IVML type.- Specified by:
resolveTypein interfaceITypeResolver- Parameters:
type- the type to be resolved- Returns:
- the resolved type (or null if
namecannot be resolved)
-
-