Class CompoundTypeDescriptor

    • Constructor Detail

      • CompoundTypeDescriptor

        public CompoundTypeDescriptor​(java.lang.String name,
                                      boolean isAbstract,
                                      CompoundTypeDescriptor refines,
                                      TypeRegistry registry)
                               throws VilException
        Creates a compound type descriptor.
        Parameters:
        name - the name of the type
        isAbstract - if the type is abstract
        refines - if there is a refined type (may be null for none)
        registry - the defining type registry
        Throws:
        VilException - in case of creation problems
    • 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
      • 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
      • 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
      • getRefines

        public CompoundTypeDescriptor getRefines()
        Returns the refined compound.
        Returns:
        the refined compound (may be null if there is none)
      • 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
      • 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
      • isAbstract

        public boolean isAbstract()
        Returns whether the compound is abstract.
        Returns:
        true for abstract, false else
      • 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<CompoundInstance>
        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<CompoundInstance>
        Returns:
        true if this is a VIL collection, 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<CompoundInstance>
        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<CompoundInstance>
        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<CompoundInstance>
        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
      • setFields

        public void setFields​(CompoundTypeDescriptor.SlotDescriptor[] slots)
                       throws VilException
        Sets the fields of this descriptor, only if there have no fields been defined at all so far.
        Parameters:
        slots - the slots defining the fields
        Throws:
        VilException - in case that fields have been defined already
      • getSlot

        public CompoundTypeDescriptor.SlotDescriptor getSlot​(int index)
        Returns the specified slot descriptor.
        Parameters:
        index - the 0-based index of the field to be returned
        Returns:
        the specified field
        Throws:
        java.lang.IndexOutOfBoundsException - if index < 0 || index>=getSlotCount()
      • getSlotCount

        public int getSlotCount()
        Returns the number of slots provided by this compound type.
        Returns:
        the number of slots
      • getDeclaredField

        public FieldDescriptor getDeclaredField​(java.lang.String name)
        Returns the directly declared field with name name.
        Parameters:
        name - the name of the field
        Returns:
        the field descriptor or null
      • getSlot

        public CompoundTypeDescriptor.SlotDescriptor getSlot​(java.lang.String name)
        Returns the slot descriptor with the specified name.
        Parameters:
        name - the name of the slot
        Returns:
        the slot descriptor (may be null if not found)
      • getDeclaredSlot

        public CompoundTypeDescriptor.SlotDescriptor getDeclaredSlot​(java.lang.String name)
        Returns the directly declared slot with name name.
        Parameters:
        name - the name of the slot
        Returns:
        the slot descriptor or null