public class ListTypeImpl extends AbstractType implements ListType
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_VALUE_SEPARATOR |
protected String |
defaultValue |
protected Field |
field |
protected boolean |
isArray |
protected int |
maxOccurs |
protected int |
minOccurs |
protected Type |
type |
constraints, EMPTY_SUPERTYPES, name, schema, superType
Constructor and Description |
---|
ListTypeImpl(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) |
Modifier and Type | Method and Description |
---|---|
Object |
convert(Object object)
Converts the given value to an object compatible with the associated type.
|
Object |
decode(String string)
Decodes the string representation into an object of this type.
|
Object |
getDefaultValue()
Gets the default value of the list elements, if any.
|
Field |
getField()
Get the field defining the elements stored by this list.
|
String |
getFieldName()
The field name if any was specified.
|
Type |
getFieldType()
Get the field describing the element type the list accept.
|
int |
getMaxCount()
Gets the required maximum count of allowed elements in this list.
|
int |
getMinCount()
Gets the required minimum count of elements in this list.
|
Type |
getType() |
boolean |
isArray()
Whether the instances of this list are arrays.
|
boolean |
isListType()
Tests whether this type is a list type.
|
boolean |
isScalarList()
This method is provided for compatibility.
|
Object |
newInstance()
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 |
validate(Object object)
Tests whether the given object is of this type.
|
protected boolean |
validateArray(Object[] array) |
protected boolean |
validateCollection(Collection col) |
addConstraints, encode, getConstraints, getName, getObjectResolver, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isComplexType, isCompositeType, isSimpleType, isSuperTypeOf, validateConstraints
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
encode, getConstraints, getName, getObjectResolver, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isSimpleType, isSuperTypeOf
protected static final String DEFAULT_VALUE_SEPARATOR
protected String defaultValue
protected int minOccurs
protected int maxOccurs
protected boolean isArray
public ListTypeImpl(String schema, String name, Type type, String fieldName, String defaultValue, int flags, Set<Constraint> constraints, int minOccurs, int maxOccurs)
public ListTypeImpl(String schema, String name, Type type, String fieldName, String defaultValue, int minOccurs, int maxOccurs)
public ListTypeImpl(String schema, String name, Type type)
public void setLimits(int minOccurs, int maxOccurs)
ListType
public void setDefaultValue(String value)
ListType
setDefaultValue
in interface ListType
public String getFieldName()
ListType
This is used to more for outputting the list as XML and for compatibility with XSD.
getFieldName
in interface ListType
public Type getFieldType()
ListType
getFieldType
in interface ListType
public Field getField()
ListType
public Object getDefaultValue()
ListType
getDefaultValue
in interface ListType
public int getMinCount()
ListType
getMinCount
in interface ListType
public int getMaxCount()
ListType
getMaxCount
in interface ListType
public boolean isListType()
Type
isListType
in interface Type
isListType
in class AbstractType
public Object decode(String string)
Type
Returns null if the string can not be decoded.
decode
in interface Type
decode
in class AbstractType
string
- the string to decodepublic boolean validate(Object object) throws TypeException
Type
validate
in interface Type
validate
in class AbstractType
object
- the object to testTypeException
- if an error occurs trying to retrieve the supertypesprotected boolean validateArray(Object[] array)
protected boolean validateCollection(Collection col)
public Object newInstance()
Type
newInstance
in interface Type
newInstance
in class AbstractType
public Object convert(Object object) throws TypeException
Type
convert
in interface Type
object
- the value to convertTypeException
- if the value to convert is not compatible with the associated typepublic boolean isArray()
ListType
public boolean isScalarList()
ListType
isScalarList
in interface ListType
Copyright © 2017 Nuxeo. All rights reserved.