Package org.nuxeo.ecm.core.schema.types
Class FieldImpl
- java.lang.Object
-
- org.nuxeo.ecm.core.schema.types.FieldImpl
-
- All Implemented Interfaces:
Serializable
,Field
public class FieldImpl extends Object implements Field
The implementation for a field, which is the association of a type, a name, and default values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FieldImpl(QName name, Type declaringType, Type type)
FieldImpl(QName name, Type declaringType, Type type, String defaultValue, int flags)
FieldImpl(QName name, Type declaringType, Type type, String defaultValue, int flags, Collection<Constraint> constraints)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Constraint>
getConstraints()
Type
getDeclaringType()
Gets the complex type or list type that declared this field.Object
getDefaultValue()
Gets this field default value or null if none.int
getMaxLength()
Gets the maximum length for this field.int
getMaxOccurs()
Gets the maximum number this field may occurs in the owner type.int
getMinOccurs()
Gets the minimum number this field may occurs in the owner type.QName
getName()
Gets the field name.Type
getType()
Gets the field type.boolean
isConstant()
Checks whether this field is constant (is read only).boolean
isNillable()
Checks whether this field is nillable (can have null values).void
setConstant(boolean isConstant)
Sets the constant flag.void
setDefaultValue(String value)
Sets the default value of this field.void
setMaxLength(int length)
Sets the maximum length for this field.void
setMaxOccurs(int max)
Sets max number of occurrences for this field.void
setMinOccurs(int min)
Sets min number of occurrences for this field.void
setNillable(boolean isNillable)
Sets the nillable flag.String
toString()
-
-
-
Constructor Detail
-
FieldImpl
public FieldImpl(QName name, Type declaringType, Type type, String defaultValue, int flags, Collection<Constraint> constraints)
-
-
Method Detail
-
getDeclaringType
public Type getDeclaringType()
Description copied from interface:Field
Gets the complex type or list type that declared this field.The declaring type may differ from the complex type owning this field.
For example, in the case of a derived complex type, the field is owned by both the derived type and the base type, but it's declared only by the base type.
- Specified by:
getDeclaringType
in interfaceField
- Returns:
- the complex that declared this field
-
getDefaultValue
public Object getDefaultValue()
Description copied from interface:Field
Gets this field default value or null if none.- Specified by:
getDefaultValue
in interfaceField
- Returns:
- the default value if any was specified, null otherwise
-
isNillable
public boolean isNillable()
Description copied from interface:Field
Checks whether this field is nillable (can have null values).- Specified by:
isNillable
in interfaceField
- Returns:
- true if the field can have null values
-
isConstant
public boolean isConstant()
Description copied from interface:Field
Checks whether this field is constant (is read only).- Specified by:
isConstant
in interfaceField
- Returns:
- true if the field is constant false otherwise
-
setDefaultValue
public void setDefaultValue(String value)
Description copied from interface:Field
Sets the default value of this field.- Specified by:
setDefaultValue
in interfaceField
- Parameters:
value
- the value to set
-
setNillable
public void setNillable(boolean isNillable)
Description copied from interface:Field
Sets the nillable flag.- Specified by:
setNillable
in interfaceField
-
setConstant
public void setConstant(boolean isConstant)
Description copied from interface:Field
Sets the constant flag.- Specified by:
setConstant
in interfaceField
-
getMaxOccurs
public int getMaxOccurs()
Description copied from interface:Field
Gets the maximum number this field may occurs in the owner type.By default this is 1. -1 is returned if not a maximum limit is imposed.
- Specified by:
getMaxOccurs
in interfaceField
- Returns:
- the max occurrences
-
getMinOccurs
public int getMinOccurs()
Description copied from interface:Field
Gets the minimum number this field may occurs in the owner type.By default this is 1.
- Specified by:
getMinOccurs
in interfaceField
- Returns:
- the min occurrences
-
setMaxOccurs
public void setMaxOccurs(int max)
Description copied from interface:Field
Sets max number of occurrences for this field.- Specified by:
setMaxOccurs
in interfaceField
- Parameters:
max
- max number of occurrences
-
setMinOccurs
public void setMinOccurs(int min)
Description copied from interface:Field
Sets min number of occurrences for this field.- Specified by:
setMinOccurs
in interfaceField
- Parameters:
min
- min number of occurrences
-
getMaxLength
public int getMaxLength()
Description copied from interface:Field
Gets the maximum length for this field.Value -1 means no constraint.
- Specified by:
getMaxLength
in interfaceField
- Returns:
- the length
-
setMaxLength
public void setMaxLength(int length)
Description copied from interface:Field
Sets the maximum length for this field.- Specified by:
setMaxLength
in interfaceField
- Parameters:
length
- the length, or -1 for no constraint
-
getConstraints
public Set<Constraint> getConstraints()
- Specified by:
getConstraints
in interfaceField
- Returns:
- The constraints applied to this field.
-
-