Class CollectionType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable

    public class CollectionType
    extends Type
    A type representing a typed collection.

    The actual type of the collection may be one of the following:

    • collection ( use COLLECTION )
    • set ( use SET ) which contains unique elements
    • list ( use LIST ) which is ordered
    See Also:
    Serialized Form
    • Constructor Detail

      • CollectionType

        public CollectionType()
    • Method Detail

      • getEscapedCollectionPositions

        public static int[] getEscapedCollectionPositions​(java.lang.String escaped,
                                                          int startFrom)
        Since:
        2.10
      • escapeForCollection

        protected static final java.lang.String escapeForCollection​(java.lang.String raw)
        Since:
        2.10
      • unescapeForCollection

        protected static final java.lang.String unescapeForCollection​(java.lang.String escaped)
        Since:
        2.10
      • getElementType

        public Type getElementType()
        Returns the type of the elements of this collection type.
      • getElementType

        public Type getElementType​(SessionContext ctx)
        Returns the type of the elements of this collection.
      • getTypeOfCollection

        public int getTypeOfCollection()
        Returns:
        the internal type of the collection as one of
      • newInstance

        public java.util.Collection newInstance()
        Returns an empty collection if the specified type (see @link #getTypeOfCollection()}).
      • getXMLDefinition

        public java.lang.String getXMLDefinition()
        Assembles the XML definition string to put inside a items.xml .
        Specified by:
        getXMLDefinition in class Type
      • isAssignableFrom

        public boolean isAssignableFrom​(Type type)
        Tests whether this collection type is assignable from another collection type. This is only true if this type's element type is assignable from the other collection type's element type and the type of collections are assignable.
        Specified by:
        isAssignableFrom in class Type
        Parameters:
        type - the type to be checked.
        See Also:
        isTypeAssignableFrom(int, int)
      • isInstance

        public boolean isInstance​(java.lang.Object o)
        Tests if a given object is instance of this collection type. This checks the type of collection and each element of being instance of the element type.

        Since all elements are checked this method is considerably costly so use with care!

        Specified by:
        isInstance in class Type
        Parameters:
        o - the object to be checked.