Class AbstractType

    • Field Detail

      • EMPTY_SUPERTYPES

        public static final Type[] EMPTY_SUPERTYPES
      • name

        protected final String name
      • schema

        protected final String schema
      • superType

        protected final Type superType
    • Constructor Detail

      • AbstractType

        protected AbstractType​(Type superType,
                               String schema,
                               String name)
    • Method Detail

      • getSuperType

        public Type getSuperType()
        Description copied from interface: Type
        Gets the super type.
        Specified by:
        getSuperType in interface Type
        Returns:
        the super type or null if this is a primitive type
      • getName

        public String getName()
        Description copied from interface: Type
        Gets the name of this type.
        Specified by:
        getName in interface Type
        Returns:
        the type name
      • getSchemaName

        public String getSchemaName()
        Description copied from interface: Type
        Gets the local name of this type.
        Specified by:
        getSchemaName in interface Type
        Returns:
        the local name
      • getSchema

        public Schema getSchema()
        Description copied from interface: Type
        Gets the schema defining this type.
        Specified by:
        getSchema in interface Type
      • isSuperTypeOf

        public boolean isSuperTypeOf​(Type type)
        Description copied from interface: Type
        Tests whether the given type is derived from this type.
        Specified by:
        isSuperTypeOf in interface Type
        Parameters:
        type - the type to test
        Returns:
        true if the given type is derived from this type, false otherwise
      • isAny

        public boolean isAny()
      • getTypeHierarchy

        public Type[] getTypeHierarchy()
        Description copied from interface: Type
        Gets the entire hierarchy of super-types.

        The array is ordered as follows:

        • the direct super type is the first element,
        • the super super type is the second element,
        • and so on.

        The returned array is never null. An empty array is returned in the case of ANY type.

        Specified by:
        getTypeHierarchy in interface Type
        Returns:
        an array containing the supertypes of this type
      • isSimpleType

        public boolean isSimpleType()
        Description copied from interface: Type
        Tests whether this type is a simple type.
        Specified by:
        isSimpleType in interface Type
        Returns:
        true if this type is a simple type, false otherwise
      • isComplexType

        public boolean isComplexType()
        Description copied from interface: Type
        Tests whether this type is a complex type.
        Specified by:
        isComplexType in interface Type
        Returns:
        true if this type is a complex type, false otherwise
      • isListType

        public boolean isListType()
        Description copied from interface: Type
        Tests whether this type is a list type.
        Specified by:
        isListType in interface Type
        Returns:
        true if is a list type, false otherwise
      • isAnyType

        public boolean isAnyType()
        Description copied from interface: Type
        Tests whether this type is the ANY type.
        Specified by:
        isAnyType in interface Type
        Returns:
        true if it is the ANY type, false otherwise
      • isCompositeType

        public boolean isCompositeType()
        Description copied from interface: Type
        Tests whether this is a composite type.
        Specified by:
        isCompositeType in interface Type
        Returns:
        true if this is a composite type, false otherwise
      • validate

        public boolean validate​(Object object)
                         throws TypeException
        Description copied from interface: Type
        Tests whether the given object is of this type.
        Specified by:
        validate in interface Type
        Parameters:
        object - the object to test
        Returns:
        true if the given object if of this type, false otherwise
        Throws:
        TypeException - if an error occurs trying to retrieve the supertypes
      • decode

        public Object decode​(String string)
        Description copied from interface: Type
        Decodes the string representation into an object of this type.

        Returns null if the string can not be decoded.

        Specified by:
        decode in interface Type
        Parameters:
        string - the string to decode
        Returns:
        the converted object that can be use as a value for an object of this type or null if the given object cannot be converted
      • encode

        public String encode​(Object object)
        Description copied from interface: Type
        Encodes the given object that is assumed to be of this type into a string representation.

        Null is returned if the object cannot be converted.

        Specified by:
        encode in interface Type
        Parameters:
        object - the object to convert
        Returns:
        the string representation of the given object or null if object cannot be converted
      • newInstance

        public Object newInstance()
        Description copied from interface: Type
        Creates a new instance according to this type and filled with default values.
        Specified by:
        newInstance in interface Type
      • validateConstraints

        protected boolean validateConstraints​(Object object)
      • getObjectResolver

        public ObjectResolver getObjectResolver()
        Description copied from interface: Type
        Provides a ObjectResolver if this type is a reference to an external entity.
        Specified by:
        getObjectResolver in interface Type
        Returns:
        a resolver if available, null otherwise.