Class MapType

All Implemented Interfaces:
Serializable, Comparable

public class MapType extends Type
This type represents a typed map. Both argument type and element type is typed.

Map types fulfil s special role describing localized attributes since each localized attribute must point to a map type having the Language composed type as argument type and the actual attribute type as return type.

See Also:
  • Field Details

    • ARGUMENT_TYPE

      public static final String ARGUMENT_TYPE
      The argument type attribute string constant.
    • RETURN_TYPE

      public static final String RETURN_TYPE
      The element (or return ) type attribute string constant.
  • Constructor Details

    • MapType

      public MapType()
  • Method Details

    • createItem

      protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
      The generic creation method for maptypes.

      The following attributes are required:

      Specified by:
      createItem in class Item
      Parameters:
      ctx - the current session context which this item is created within
      type - the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )
      Returns:
      the new item instance
      Throws:
      JaloBusinessException - indicates an error during creation - any changes will be rollbacked
    • getNonInitialAttributes

      protected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
      Cuts the following attributes which have been already set during creation:
      Overrides:
      getNonInitialAttributes in class Item
      Parameters:
      ctx - session context with language = NULL
      allAttributes - a ItemAttributeMap contaning attribute values.
      Returns:
      a ItemAttributeMap containing all attribute values, which belong to non-initial attributes.
    • getEscapedMapPositions

      public static int[] getEscapedMapPositions(String escaped, int startFrom)
      Since:
      2.10
    • escapeForMap

      protected static final String escapeForMap(String raw)
      Since:
      2.10
    • unescapeForMap

      protected static final String unescapeForMap(String escaped)
      Since:
      2.10
    • toString

      public String toString(SessionContext ctx, Object value) throws JaloInvalidParameterException
      Specified by:
      toString in class Type
      Throws:
      JaloInvalidParameterException
      Since:
      2.10
    • parseValue

      public Object parseValue(SessionContext ctx, String value) throws JaloInvalidParameterException
      Specified by:
      parseValue in class Type
      Throws:
      JaloInvalidParameterException
      Since:
      2.10
    • getArgumentType

      public Type getArgumentType()
      Returns the argument type.
    • getArgumentType

      public Type getArgumentType(SessionContext ctx)
      Returns the argument type.
    • getReturnType

      public Type getReturnType()
      Returns the element ( or return-) type.
    • getReturnType

      public Type getReturnType(SessionContext ctx)
      Returns the element ( or return-) type.
    • getXMLDefinition

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

      public String exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)
      Specified by:
      exportXMLDefinition in class TypeManagerManaged
    • getMapTypeImpl

      protected MapType.MapTypeImpl getMapTypeImpl()
      Internal access to persistence layer implementation.
    • isAssignableFrom

      public boolean isAssignableFrom(Type type)
      Checks if this maptype is assignable from another maptype.

      This is true if its argument type is assignable from the other type's argument type and its element type is assignable from the other type's element type.

      Specified by:
      isAssignableFrom in class Type
      Parameters:
      type - the type to be checked.
    • isInstance

      public boolean isInstance(Object o)
      Checks if a given object is instance of this maptype.

      This is true if the object is a map and each key is instance of the argument type and each value is instance of the element type.

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

      public boolean typeCheckContent(Map map)
      Helper method for isInstance(Object). Checks content of a map if it is compatible with the argument and element type.
    • toString

      public String toString()
      The string representation of this map type.
      Overrides:
      toString in class Type
      Returns:
      the String representation of this item.