Class Type

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
AtomicType, CollectionType, ComposedType, MapType

public abstract class Type extends TypeManagerManaged
Abstract base class for all types.

Types have a unique (case insensitive) code, know their instances and may provide a default value.

See Also:
  • Field Details

    • DEFAULTVALUE

      public static final String DEFAULTVALUE
      The default value attribute string constant.
    • DESCRIPTION

      public static final String DESCRIPTION
      The description attribute string constant.
    • CODE

      public static final String CODE
      The code attribute string constant.
    • XMLDEFINITION

      public static final String XMLDEFINITION
      The xml definition attribute string constant.
  • Constructor Details

    • Type

      public Type()
  • Method Details

    • getCode

      public String getCode()
      Returns the unique code of this type.
    • getDefaultValue

      public Object getDefaultValue()
      Returns the default value of this type.
    • getDefaultValue

      public Object getDefaultValue(SessionContext ctx)
      Returns the default value of this type.
    • setDefaultValue

      public void setDefaultValue(Object value) throws JaloInvalidParameterException
      Changes the default value of this type.
      Throws:
      JaloInvalidParameterException
    • setDefaultValue

      public void setDefaultValue(SessionContext ctx, Object value) throws JaloInvalidParameterException
      Changes the default value of this type.
      Throws:
      JaloInvalidParameterException
    • toString

      public abstract String toString(SessionContext ctx, Object value) throws JaloInvalidParameterException
      Throws:
      JaloInvalidParameterException
      Since:
      2.10
    • parseValue

      public abstract Object parseValue(SessionContext ctx, String value) throws JaloInvalidParameterException
      Throws:
      JaloInvalidParameterException
      Since:
      2.10
    • isAssignableFrom

      public abstract boolean isAssignableFrom(Type type)
      Tests if this type is assignable from a given type.

      This is true if this type equals or is supertype of the given type.

      Parameters:
      type - the type to be checked.
    • isInstance

      public abstract boolean isInstance(Object o)
      Test whether an object is an instance of this type or not.

      This is true if this type is type of this object or is supertype of the object's type.

      Parameters:
      o - the object to be checked.
    • getDescription

      public String getDescription()
      Returns:
      the description of this type localized for the current session language.
    • getDescription

      public String getDescription(SessionContext ctx)
      Returns:
      the description of this type localized by the given session context.
    • setDescription

      public void setDescription(String description)
      Changes the type description for the current session language.
      Parameters:
      description - the new description.
    • setDescription

      public void setDescription(SessionContext ctx, String description)
      Changes the type description for the given session context language.
      Parameters:
      ctx - the session context defining the language to set the description for
      description - the new description.
    • getAllDescriptions

      public Map getAllDescriptions()
      Returns:
      all descriptions at once in form of a language-to-description map.
    • getAllDescriptions

      public Map getAllDescriptions(SessionContext ctx)
      Returns:
      all descriptions at once in form of a language-to-description map.
    • setAllDescriptions

      public void setAllDescriptions(Map descriptions)
      Changes all descriptions by specifying a language-to-description map. All previous descriptions are removed.
      Parameters:
      descriptions - all new names as language-to-description map
    • setAllDescriptions

      public void setAllDescriptions(SessionContext ctx, Map descriptions)
      Changes all descriptions by specifying a language-to-description map. All previous descriptions are removed.
      Parameters:
      descriptions - all new descriptions as language-to-description map
    • toString

      public String toString()
      Provides a string representation of this type.
      Overrides:
      toString in class Item
      Returns:
      the String representation of this item.
    • getXMLDefinition

      public abstract String getXMLDefinition()
      Returns the XML definition string as expected by items.xml .
    • getTypeImpl

      protected Type.TypeImpl getTypeImpl()
      Internal access to persistence layer implementation.
    • compareTo

      public int compareTo(Object o)
      Makes types comparable by their code (case insenesitive).
      Specified by:
      compareTo in interface Comparable
      Overrides:
      compareTo in class Item
      Parameters:
      o - which will be compared to this item.
      Returns:
      the value 0 if the argument item pk is equal to this item pk; a value less than 0 if this item pk is lexicographically less than the argument item pk; and a value greater than 0 if this item pk is lexicographically greater than the argument item pk.