Class FakeTypeDescriptor
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<IvmlElement>
-
- net.ssehub.easy.instantiation.core.model.vilTypes.configuration.FakeTypeDescriptor
-
- All Implemented Interfaces:
IMetaType
public class FakeTypeDescriptor extends TypeDescriptor<IvmlElement>
Represents a fake type descriptor for IVML. This type descriptor which not correspond to a real type but is inserted to allow the execution of scripts with unknown types (in the presence of advices). Operations with fake types shall be ignored during execution.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private TypeDescriptor<?>baseTypeprivate TypeRegistryregistry-
Fields inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor
EMPTY
-
-
Constructor Summary
Constructors Constructor Description FakeTypeDescriptor(TypeRegistry registry, java.lang.String name)Creates a fake type descriptor without (!) known base type.FakeTypeDescriptor(TypeRegistry registry, java.lang.String name, TypeDescriptor<?> baseType)Creates a fake type descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OperationDescriptoraddPlaceholderOperation(java.lang.String name, int parameterCount, boolean acceptsNamedParameters)Adds a placeholder operation, i.e., in case that the original operation cannot be resolved but the script shall remain executable.booleancanBeInstantiated()Returns whetherTypeDescriptor.create(Object...)will return an instance.booleancheckConversion(IMetaType param, IMetaOperation conversion)Checks a conversion from this type toparamvia the givenconversion.IvmlElementcreate(java.lang.Object... params)Creates an instance of the type according to the given parameters.IMetaTypegetBaseType()Returns the base type (in case of IVML derived types).IMetaTypegetSuperType()Returns the type this type is refined from.java.lang.Class<IvmlElement>getTypeClass()Returns the class of the described VIL type.TypeRegistrygetTypeRegistry()Returns the type registry this type was registered by.booleanisActualTypeOf(IMetaType type)Returns whether this type can act as an actual type oftype.booleanisAssignableFrom(IMetaType type)Returns whether this type is the same or a super class oftype.booleanisAssignableFrom(TypeDescriptor<?> desc)Returns whether this descriptor is the same or a super class ofdesc.booleanisBasicType()Returns whether this instance represents a basic type.booleanisCollection()Returns whether this descriptor represents a VIL collection, i.e., set, sequence or collection.booleanisInstance(java.lang.Object object)Returns whether the givenobjectis an instance of this descriptor.booleanisInstantiator()Returns whether this type is an instantiator.booleanisInternal()Returns whether this type is internal and shall not be visible to the user.booleanisIterator()Returns whether this descriptor represents an iterator.booleanisMap()Returns whether this descriptor represents a VIL map.booleanisPlaceholder()Returns whether this type is valid or whether it is a placeholder type in case that the original type cannot be resolved but the script shall remain executable.booleanisSameType(java.lang.Object object)Returns whether the givenobjectof of the type of this descriptor.booleanisSequence()Returns whether this descriptor represents a VIL sequence.booleanisSet()Returns whether this descriptor represents a VIL set.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor
addOperation, allInstances, appendParameter, createArray, enableDynamicDispatch, findCollectionIteratorOperation, findConversion, findConversion, findConversionOnBoth, flatten, flattenParam, getCandidates, getCandidates, getConversion, getConversions, getConversionsCount, getConversionToSequence, getDefaultValue, getField, getField, getFieldCount, getFields, getGenericParameter, getGenericParameterCount, getGenericParameterType, getName, getOperation, getOperations, getOperationsCount, getQualifiedName, getVilName, isFieldsNull, isInitialized, isNameSet, isSame, setConversions, setFields, setFields, setName, setOperations, toString
-
-
-
-
Field Detail
-
registry
private TypeRegistry registry
-
baseType
private TypeDescriptor<?> baseType
-
-
Constructor Detail
-
FakeTypeDescriptor
FakeTypeDescriptor(TypeRegistry registry, java.lang.String name) throws VilException
Creates a fake type descriptor without (!) known base type.- Parameters:
registry- the type registry this type was created forname- the name of the type- Throws:
VilException- in case that the creation fails
-
FakeTypeDescriptor
FakeTypeDescriptor(TypeRegistry registry, java.lang.String name, TypeDescriptor<?> baseType) throws VilException
Creates a fake type descriptor.- Parameters:
registry- the type registry this type was created forname- the name of the typebaseType- the known base type, may be null- Throws:
VilException- in case that the creation fails
-
-
Method Detail
-
isAssignableFrom
public boolean isAssignableFrom(IMetaType type)
Description copied from interface:IMetaTypeReturns whether this type is the same or a super class oftype.- Parameters:
type- the descriptor to be tested- Returns:
trueif both types are assignment compatible,falseelse
-
isBasicType
public boolean isBasicType()
Description copied from interface:IMetaTypeReturns whether this instance represents a basic type.- Returns:
trueif this instance represents a basic type,falseelse
-
getTypeRegistry
public TypeRegistry getTypeRegistry()
Description copied from interface:IMetaTypeReturns the type registry this type was registered by.- Returns:
- the type registry
-
isPlaceholder
public boolean isPlaceholder()
Description copied from interface:IMetaTypeReturns whether this type is valid or whether it is a placeholder type in case that the original type cannot be resolved but the script shall remain executable.- Returns:
trueif this type is a placeholder,falseelse
-
getTypeClass
public java.lang.Class<IvmlElement> getTypeClass()
Description copied from class:TypeDescriptorReturns the class of the described VIL type. Please use this method sparingly as the required functionality is provided by this class.- Specified by:
getTypeClassin classTypeDescriptor<IvmlElement>- Returns:
- the class
-
canBeInstantiated
public boolean canBeInstantiated()
Description copied from class:TypeDescriptorReturns whetherTypeDescriptor.create(Object...)will return an instance.- Specified by:
canBeInstantiatedin classTypeDescriptor<IvmlElement>- Returns:
trueif this type can be instantiated from VIL/VTL,falseelse
-
create
public IvmlElement create(java.lang.Object... params) throws VilException
Description copied from class:TypeDescriptorCreates an instance of the type according to the given parameters.- Specified by:
createin classTypeDescriptor<IvmlElement>- Parameters:
params- the parameters- Returns:
- the created instance
- Throws:
VilException- in case that the creation does not work
-
isAssignableFrom
public boolean isAssignableFrom(TypeDescriptor<?> desc)
Description copied from class:TypeDescriptorReturns whether this descriptor is the same or a super class ofdesc.- Specified by:
isAssignableFromin classTypeDescriptor<IvmlElement>- Parameters:
desc- the descriptor to be tested- Returns:
trueif both descriptors are assignment compatible,falseelse
-
isCollection
public boolean isCollection()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL collection, i.e., set, sequence or collection.- Specified by:
isCollectionin classTypeDescriptor<IvmlElement>- Returns:
trueif this is a VIL collection,falseelse
-
isIterator
public boolean isIterator()
Description copied from class:TypeDescriptorReturns whether this descriptor represents an iterator.- Specified by:
isIteratorin classTypeDescriptor<IvmlElement>- Returns:
trueif this is an iterator,falseelse
-
isMap
public boolean isMap()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL map.- Specified by:
isMapin classTypeDescriptor<IvmlElement>- Returns:
trueif this is a VIL map,falseelse
-
isSet
public boolean isSet()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL set.- Specified by:
isSetin classTypeDescriptor<IvmlElement>- Returns:
trueif this is a VIL set,falseelse
-
isSequence
public boolean isSequence()
Description copied from class:TypeDescriptorReturns whether this descriptor represents a VIL sequence.- Specified by:
isSequencein classTypeDescriptor<IvmlElement>- Returns:
trueif this is a VIL sequence,falseelse
-
isInstance
public boolean isInstance(java.lang.Object object)
Description copied from class:TypeDescriptorReturns whether the givenobjectis an instance of this descriptor.- Specified by:
isInstancein classTypeDescriptor<IvmlElement>- Parameters:
object- the object to be checked- Returns:
trueif it is an instance,falseelse
-
isSameType
public boolean isSameType(java.lang.Object object)
Description copied from class:TypeDescriptorReturns whether the givenobjectof of the type of this descriptor.- Specified by:
isSameTypein classTypeDescriptor<IvmlElement>- Parameters:
object- the object to be checked- Returns:
trueifobjecthas the same type,falseelse
-
addPlaceholderOperation
public OperationDescriptor addPlaceholderOperation(java.lang.String name, int parameterCount, boolean acceptsNamedParameters)
Description copied from class:TypeDescriptorAdds a placeholder operation, i.e., in case that the original operation cannot be resolved but the script shall remain executable.- Specified by:
addPlaceholderOperationin interfaceIMetaType- Specified by:
addPlaceholderOperationin classTypeDescriptor<IvmlElement>- Parameters:
name- the name of the operationparameterCount- the number of parameters of the operationacceptsNamedParameters- whether the operation accepts named parameters- Returns:
- the added operation, null if this type is not a
placeholder
-
isActualTypeOf
public boolean isActualTypeOf(IMetaType type)
Description copied from interface:IMetaTypeReturns whether this type can act as an actual type oftype.- Parameters:
type- the type to be checked- Returns:
trueif this type can act as an actual type oftype,falseelse- See Also:
IActualTypeProvider
-
getBaseType
public IMetaType getBaseType()
Description copied from interface:IMetaTypeReturns the base type (in case of IVML derived types).- Returns:
- the base type or null
-
isInternal
public boolean isInternal()
Description copied from interface:IMetaTypeReturns whether this type is internal and shall not be visible to the user.- Returns:
trueif this type is internal,falseelse
-
isInstantiator
public boolean isInstantiator()
Description copied from class:TypeDescriptorReturns whether this type is an instantiator.- Specified by:
isInstantiatorin classTypeDescriptor<IvmlElement>- Returns:
trueif it is an instantiator,falseelse
-
getSuperType
public IMetaType getSuperType()
Description copied from interface:IMetaTypeReturns the type this type is refined from.- Returns:
- the super type or null if there is none
-
checkConversion
public boolean checkConversion(IMetaType param, IMetaOperation conversion)
Description copied from interface:IMetaTypeChecks a conversion from this type toparamvia the givenconversion.- Parameters:
param- the original parameter valueconversion- the conversion function- Returns:
trueif ok,falseelse
-
-