Package org.nuxeo.ecm.core.schema.types
Class FieldImpl
java.lang.Object
org.nuxeo.ecm.core.schema.types.FieldImpl
- All Implemented Interfaces:
Serializable
,Field
The implementation for a field, which is the association of a type, a name, and default values.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the complex type or list type that declared this field.Gets this field default value or null if none.int
Gets the maximum length for this field.int
Gets the maximum number this field may occurs in the owner type.int
Gets the minimum number this field may occurs in the owner type.getName()
Gets the field name.getType()
Gets the field type.boolean
Checks whether this field is constant (is read only).boolean
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.toString()
-
Constructor Details
-
FieldImpl
public FieldImpl(QName name, Type declaringType, Type type, String defaultValue, int flags, Collection<Constraint> constraints) -
FieldImpl
-
FieldImpl
-
-
Method Details
-
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
-
getName
Description copied from interface:Field
Gets the field name. -
getType
Description copied from interface:Field
Gets the field type. -
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
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
-
toString
-
getConstraints
- Specified by:
getConstraints
in interfaceField
- Returns:
- The constraints applied to this field.
-