Interface IMetaType
-
- All Known Subinterfaces:
IResolvableModel<V,M>,ITypedModel
- All Known Implementing Classes:
AbstractIvmlTypeDescriptor,AbstractResolvableModel,ActualValueReflectionTypeDescriptor,AliasTypeDescriptor,ClassWrapper,CompoundTypeDescriptor,DummyModel,FakeTypeDescriptor,IvmlProjectTypeDescriptor,IvmlTypeDescriptor,ReflectionTypeDescriptor,Script,Template,TypeDescriptor
public interface IMetaTypeDefines the interface of a meta type. This interface is used for generic type conformance checks.- Author:
- Holger Eichelberger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IMetaOperationaddPlaceholderOperation(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.booleancheckConversion(IMetaType param, IMetaOperation conversion)Checks a conversion from this type toparamvia the givenconversion.booleanenableDynamicDispatch()Returns whether this type enables dynamic dispatch of operations.IMetaOperationfindConversion(IMetaType sourceType, IMetaType targetType)Returns the conversion operation from this type to target type (if there is any).IMetaTypegetBaseType()Returns the base type (in case of IVML derived types).java.util.List<IMetaOperation>getCandidates(java.lang.String name, int unnamedArgsCount)Returns operation candidates matching the given name and number of unnamed (required) arguments.IMetaFieldgetField(int index)Returns the specified field.intgetFieldCount()Returns the number of fields provided by this type.intgetGenericParameterCount()Returns the number of generic type parameters.TypeDescriptor<?>getGenericParameterType(int index)Returns the specified generic parameter type.java.lang.StringgetName()Returns the (simple) name of this type.IMetaOperationgetOperation(int index)Returns the specified operation.intgetOperationsCount()Returns the number of operations provided by this type.java.lang.StringgetQualifiedName()Returns the qualified name of this type.IMetaTypegetSuperType()Returns the type this type is refined from.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.booleanisBasicType()Returns whether this instance represents a basic type.booleanisInternal()Returns whether this type is internal and shall not be visible to the user.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.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the (simple) name of this type.- Returns:
- the simple name
-
getQualifiedName
java.lang.String getQualifiedName()
Returns the qualified name of this type.- Returns:
- the qualified name
-
getOperationsCount
int getOperationsCount()
Returns the number of operations provided by this type.- Returns:
- the number of operations
-
getOperation
IMetaOperation getOperation(int index)
Returns the specified operation.- Parameters:
index- the 0-based index of the operation to be returned- Returns:
- the specified operation
- Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index>=getOperationsCount()
-
getGenericParameterCount
int getGenericParameterCount()
Returns the number of generic type parameters.- Returns:
- the number of generic type parameters
-
getGenericParameterType
TypeDescriptor<?> getGenericParameterType(int index)
Returns the specified generic parameter type.- Parameters:
index- the index of the parameter type to return- Returns:
- the specified parameter type
- Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index >=getGenericParameterCount()
-
getFieldCount
int getFieldCount()
Returns the number of fields provided by this type.- Returns:
- the number of fields
-
getField
IMetaField getField(int index)
Returns the specified field.- Parameters:
index- the 0-based index of the field to be returned- Returns:
- the specified field
- Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index>=getFieldCount()
-
isAssignableFrom
boolean isAssignableFrom(IMetaType type)
Returns 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
-
findConversion
IMetaOperation findConversion(IMetaType sourceType, IMetaType targetType)
Returns the conversion operation from this type to target type (if there is any).- Parameters:
sourceType- the source type to convert fromtargetType- the target type to convert to- Returns:
- the conversion operation as defined in the underlying implementation class, null if no matching can be found
-
isBasicType
boolean isBasicType()
Returns whether this instance represents a basic type.- Returns:
trueif this instance represents a basic type,falseelse
-
getTypeRegistry
TypeRegistry getTypeRegistry()
Returns the type registry this type was registered by.- Returns:
- the type registry
-
enableDynamicDispatch
boolean enableDynamicDispatch()
Returns whether this type enables dynamic dispatch of operations.- Returns:
trueif it enables dynamic dispatch,falseelse
-
isPlaceholder
boolean isPlaceholder()
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.- Returns:
trueif this type is a placeholder,falseelse
-
addPlaceholderOperation
IMetaOperation addPlaceholderOperation(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.- Parameters:
name- the name of the operationparameterCount- the number of parameters of the operationacceptsNamedParameters- whether the operation shall accept named parameters- Returns:
- the added operation, null if this type is not a
placeholder
-
isActualTypeOf
boolean isActualTypeOf(IMetaType type)
Returns 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
IMetaType getBaseType()
Returns the base type (in case of IVML derived types).- Returns:
- the base type or null
-
getSuperType
IMetaType getSuperType()
Returns the type this type is refined from.- Returns:
- the super type or null if there is none
-
isInternal
boolean isInternal()
Returns whether this type is internal and shall not be visible to the user.- Returns:
trueif this type is internal,falseelse
-
checkConversion
boolean checkConversion(IMetaType param, IMetaOperation conversion)
Checks a conversion from this type toparamvia the givenconversion.- Parameters:
param- the original parameter valueconversion- the conversion function- Returns:
trueif ok,falseelse
-
getCandidates
java.util.List<IMetaOperation> getCandidates(java.lang.String name, int unnamedArgsCount)
Returns operation candidates matching the given name and number of unnamed (required) arguments.- Parameters:
name- the name of the operationunnamedArgsCount- the number of unnamed arguments- Returns:
- the operation candidates
-
-