Package org.nuxeo.ecm.core.schema.types
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
The implementation for a List type.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
protected String
protected final Field
protected boolean
protected int
protected int
protected final Type
Fields inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
constraints, EMPTY_SUPERTYPES, name, schema, superType
-
Constructor Summary
ConstructorDescriptionListTypeImpl
(String schema, String name, Type type) ListTypeImpl
(String schema, String name, Type type, String fieldName, String defaultValue, int minOccurs, int maxOccurs) ListTypeImpl
(String schema, String name, Type type, String fieldName, String defaultValue, int flags, Set<Constraint> constraints, int minOccurs, int maxOccurs) -
Method Summary
Modifier and TypeMethodDescriptionConverts the given value to an object compatible with the associated type.Decodes the string representation into an object of this type.Gets the default value of the list elements, if any.getField()
Get the field defining the elements stored by this list.The field name if any was specified.Get the field describing the element type the list accept.int
Gets the required maximum count of allowed elements in this list.int
Gets the required minimum count of elements in this list.getType()
boolean
isArray()
Whether the instances of this list are arrays.boolean
Tests whether this type is a list type.boolean
This method is provided for compatibility.Creates a new instance according to this type and filled with default values.void
setDefaultValue
(String value) Sets the default value encoded as a string.void
setLimits
(int minOccurs, int maxOccurs) Sets list limits.boolean
Tests whether the given object is of this type.Methods inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
addConstraints, encode, getConstraints, getName, getObjectResolver, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isComplexType, isCompositeType, isSimpleType, isSuperTypeOf, validateConstraints
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.ecm.core.schema.types.Type
encode, getConstraints, getName, getObjectResolver, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isSimpleType, isSuperTypeOf
-
Field Details
-
DEFAULT_VALUE_SEPARATOR
- See Also:
-
type
-
field
-
defaultValue
-
minOccurs
protected int minOccurs -
maxOccurs
protected int maxOccurs -
isArray
protected boolean isArray
-
-
Constructor Details
-
ListTypeImpl
-
ListTypeImpl
-
ListTypeImpl
-
-
Method Details
-
setLimits
public void setLimits(int minOccurs, int maxOccurs) Description copied from interface:ListType
Sets list limits. -
setDefaultValue
Description copied from interface:ListType
Sets the default value encoded as a string.- Specified by:
setDefaultValue
in interfaceListType
-
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 interfaceListType
- Returns:
- the field name
-
getFieldType
Description copied from interface:ListType
Get the field describing the element type the list accept.- Specified by:
getFieldType
in interfaceListType
- Returns:
- the field describing the list element types
-
getField
Description copied from interface:ListType
Get the field defining the elements stored by this list. -
getDefaultValue
Description copied from interface:ListType
Gets the default value of the list elements, if any.- Specified by:
getDefaultValue
in interfaceListType
- Returns:
- the default value or null if none
-
getType
-
getMinCount
public int getMinCount()Description copied from interface:ListType
Gets the required minimum count of elements in this list.- Specified by:
getMinCount
in interfaceListType
- 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 interfaceListType
- 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 interfaceType
- Overrides:
isListType
in classAbstractType
- Returns:
- true if is a list type, false otherwise
-
decode
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 interfaceType
- Overrides:
decode
in classAbstractType
- 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
Description copied from interface:Type
Tests whether the given object is of this type.- Specified by:
validate
in interfaceType
- Overrides:
validate
in classAbstractType
- 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
Description copied from interface:Type
Creates a new instance according to this type and filled with default values.- Specified by:
newInstance
in interfaceType
- Overrides:
newInstance
in classAbstractType
-
convert
Description copied from interface:Type
Converts the given value to an object compatible with the associated type.- Specified by:
convert
in interfaceType
- 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. -
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 interfaceListType
- Returns:
- true if the list items are of a scalar type TODO FIXME XXX remove the method and use instead isArray
-