Class ListTypeImpl

java.lang.Object
org.nuxeo.ecm.core.schema.types.AbstractType
org.nuxeo.ecm.core.schema.types.ListTypeImpl
All Implemented Interfaces:
Serializable, ListType, Type

public class ListTypeImpl extends AbstractType implements ListType
The implementation for a List type.
See Also:
  • Field Details

    • DEFAULT_VALUE_SEPARATOR

      protected static final String DEFAULT_VALUE_SEPARATOR
      See Also:
    • type

      protected final Type type
    • field

      protected final Field field
    • defaultValue

      protected String defaultValue
    • minOccurs

      protected int minOccurs
    • maxOccurs

      protected int maxOccurs
    • isArray

      protected boolean isArray
  • Constructor Details

  • Method Details

    • setLimits

      public void setLimits(int minOccurs, int maxOccurs)
      Description copied from interface: ListType
      Sets list limits.
      Specified by:
      setLimits in interface ListType
    • setDefaultValue

      public void setDefaultValue(String value)
      Description copied from interface: ListType
      Sets the default value encoded as a string.
      Specified by:
      setDefaultValue in interface ListType
    • getFieldName

      public String getFieldName()
      Description copied from interface: ListType
      The field name if any was specified.

      This is used to more for outputting the list as XML and for compatibility with XSD.

      Specified by:
      getFieldName in interface ListType
      Returns:
      the field name
    • getFieldType

      public Type getFieldType()
      Description copied from interface: ListType
      Get the field describing the element type the list accept.
      Specified by:
      getFieldType in interface ListType
      Returns:
      the field describing the list element types
    • getField

      public Field getField()
      Description copied from interface: ListType
      Get the field defining the elements stored by this list.
      Specified by:
      getField in interface ListType
      Returns:
      the field
    • getDefaultValue

      public Object getDefaultValue()
      Description copied from interface: ListType
      Gets the default value of the list elements, if any.
      Specified by:
      getDefaultValue in interface ListType
      Returns:
      the default value or null if none
    • getType

      public Type getType()
    • getMinCount

      public int getMinCount()
      Description copied from interface: ListType
      Gets the required minimum count of elements in this list.
      Specified by:
      getMinCount in interface ListType
      Returns:
      the minimum count of required elements
    • getMaxCount

      public int getMaxCount()
      Description copied from interface: ListType
      Gets the required maximum count of allowed elements in this list.
      Specified by:
      getMaxCount in interface ListType
      Returns:
      the maximum count of allowed elements
    • isListType

      public boolean isListType()
      Description copied from interface: Type
      Tests whether this type is a list type.
      Specified by:
      isListType in interface Type
      Overrides:
      isListType in class AbstractType
      Returns:
      true if is a list type, false otherwise
    • 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
      Overrides:
      decode in class AbstractType
      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
    • 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
      Overrides:
      validate in class AbstractType
      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
    • 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
      Overrides:
      newInstance in class AbstractType
    • convert

      public Object convert(Object object) throws TypeException
      Description copied from interface: Type
      Converts the given value to an object compatible with the associated type.
      Specified by:
      convert in interface Type
      Parameters:
      object - the value to convert
      Returns:
      the converted value
      Throws:
      TypeException - if the value to convert is not compatible with the associated type
    • isArray

      public boolean isArray()
      Description copied from interface: ListType
      Whether the instances of this list are arrays.
      Specified by:
      isArray in interface ListType
    • isScalarList

      public boolean isScalarList()
      Description copied from interface: ListType
      This method is provided for compatibility. Existing code is mapping scalar lists to arrays but this should be changed in order to map only explicit scalar list (those declared using xs:list) to arrays and not all list that have scalar items.
      Specified by:
      isScalarList in interface ListType
      Returns:
      true if the list items are of a scalar type TODO FIXME XXX remove the method and use instead isArray