Class 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
    • 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 for
        name - 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 for
        name - the name of the type
        baseType - 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: IMetaType
        Returns whether this type is the same or a super class of type.
        Parameters:
        type - the descriptor to be tested
        Returns:
        true if both types are assignment compatible, false else
      • isBasicType

        public boolean isBasicType()
        Description copied from interface: IMetaType
        Returns whether this instance represents a basic type.
        Returns:
        true if this instance represents a basic type, false else
      • getTypeRegistry

        public TypeRegistry getTypeRegistry()
        Description copied from interface: IMetaType
        Returns the type registry this type was registered by.
        Returns:
        the type registry
      • isPlaceholder

        public boolean isPlaceholder()
        Description copied from interface: IMetaType
        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:
        true if this type is a placeholder, false else
      • getTypeClass

        public java.lang.Class<IvmlElement> getTypeClass()
        Description copied from class: TypeDescriptor
        Returns the class of the described VIL type. Please use this method sparingly as the required functionality is provided by this class.
        Specified by:
        getTypeClass in class TypeDescriptor<IvmlElement>
        Returns:
        the class
      • isAssignableFrom

        public boolean isAssignableFrom​(TypeDescriptor<?> desc)
        Description copied from class: TypeDescriptor
        Returns whether this descriptor is the same or a super class of desc.
        Specified by:
        isAssignableFrom in class TypeDescriptor<IvmlElement>
        Parameters:
        desc - the descriptor to be tested
        Returns:
        true if both descriptors are assignment compatible, false else
      • isCollection

        public boolean isCollection()
        Description copied from class: TypeDescriptor
        Returns whether this descriptor represents a VIL collection, i.e., set, sequence or collection.
        Specified by:
        isCollection in class TypeDescriptor<IvmlElement>
        Returns:
        true if this is a VIL collection, false else
      • isIterator

        public boolean isIterator()
        Description copied from class: TypeDescriptor
        Returns whether this descriptor represents an iterator.
        Specified by:
        isIterator in class TypeDescriptor<IvmlElement>
        Returns:
        true if this is an iterator, false else
      • isMap

        public boolean isMap()
        Description copied from class: TypeDescriptor
        Returns whether this descriptor represents a VIL map.
        Specified by:
        isMap in class TypeDescriptor<IvmlElement>
        Returns:
        true if this is a VIL map, false else
      • isSet

        public boolean isSet()
        Description copied from class: TypeDescriptor
        Returns whether this descriptor represents a VIL set.
        Specified by:
        isSet in class TypeDescriptor<IvmlElement>
        Returns:
        true if this is a VIL set, false else
      • isSequence

        public boolean isSequence()
        Description copied from class: TypeDescriptor
        Returns whether this descriptor represents a VIL sequence.
        Specified by:
        isSequence in class TypeDescriptor<IvmlElement>
        Returns:
        true if this is a VIL sequence, false else
      • isInstance

        public boolean isInstance​(java.lang.Object object)
        Description copied from class: TypeDescriptor
        Returns whether the given object is an instance of this descriptor.
        Specified by:
        isInstance in class TypeDescriptor<IvmlElement>
        Parameters:
        object - the object to be checked
        Returns:
        true if it is an instance, false else
      • isSameType

        public boolean isSameType​(java.lang.Object object)
        Description copied from class: TypeDescriptor
        Returns whether the given object of of the type of this descriptor.
        Specified by:
        isSameType in class TypeDescriptor<IvmlElement>
        Parameters:
        object - the object to be checked
        Returns:
        true if object has the same type, false else
      • addPlaceholderOperation

        public OperationDescriptor addPlaceholderOperation​(java.lang.String name,
                                                           int parameterCount,
                                                           boolean acceptsNamedParameters)
        Description copied from class: TypeDescriptor
        Adds a placeholder operation, i.e., in case that the original operation cannot be resolved but the script shall remain executable.
        Specified by:
        addPlaceholderOperation in interface IMetaType
        Specified by:
        addPlaceholderOperation in class TypeDescriptor<IvmlElement>
        Parameters:
        name - the name of the operation
        parameterCount - the number of parameters of the operation
        acceptsNamedParameters - 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: IMetaType
        Returns whether this type can act as an actual type of type.
        Parameters:
        type - the type to be checked
        Returns:
        true if this type can act as an actual type of type, false else
        See Also:
        IActualTypeProvider
      • getBaseType

        public IMetaType getBaseType()
        Description copied from interface: IMetaType
        Returns the base type (in case of IVML derived types).
        Returns:
        the base type or null
      • isInternal

        public boolean isInternal()
        Description copied from interface: IMetaType
        Returns whether this type is internal and shall not be visible to the user.
        Returns:
        true if this type is internal, false else
      • getSuperType

        public IMetaType getSuperType()
        Description copied from interface: IMetaType
        Returns 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: IMetaType
        Checks a conversion from this type to param via the given conversion.
        Parameters:
        param - the original parameter value
        conversion - the conversion function
        Returns:
        true if ok, false else