public class ArrayProperty extends ScalarProperty
field, value
deprecatedFallback, flags, forceDirty, IS_READONLY, isDeprecated, NON_CANON_INDEX, parent
DIRTY_MASK, IS_DIRTY, IS_MODIFIED, IS_MOVED, IS_NEW, IS_PHANTOM, IS_REMOVED, NONE
Constructor and Description |
---|
ArrayProperty(Property parent,
Field field,
int flags) |
Modifier and Type | Method and Description |
---|---|
void |
clearDirtyFlags()
Notify the property that its changes was stored so it can safely remove dirty flags.
|
protected Serializable |
convert(Collection<?> value) |
<T> T |
convertTo(Serializable value,
Class<T> toType)
Converts the given normalized value to the given type.
|
protected boolean[] |
getChildDirty() |
ListType |
getType()
Get the type of the field corresponding to this property.
|
boolean |
isContainer()
Whether this property is a container - this means the property value is a map or a list.
|
boolean |
isDirty(int index)
This method provides a way to know if some arrayproperty values are dirty: value or index changed.
|
boolean |
isNormalized(Object value)
Checks if the given value is a normalized one.
|
protected boolean |
isSameValue(Serializable value1,
Serializable value2) |
Object |
newInstance()
Creates a new and empty instance of a normalized value.
|
Serializable |
normalize(Object value)
Normalizes the given value as dictated by the property type.
|
void |
setValue(Object value)
Sets this property value.
|
accept, addEmpty, addValue, addValue, clone, get, get, getChildren, getDirtyChildren, getField, getName, internalGetValue, internalSetValue, isSameAs, toString
appendDirtyFlags, areFlagsSet, clearFlags, collectPath, computeRemovedProperty, getDefaultValue, getDeprecatedParent, getDirtyFlags, getObjectResolver, getParent, getPath, getRoot, getSchema, getValue, getValue, getValue, getValue, getValueDeprecation, getValueForWrite, getXPath, getXPath, init, isComplex, isDeprecated, isDirty, isForceDirty, isList, isModified, isMoved, isNew, isPhantom, isReadOnly, isRemoved, isScalar, iterator, moveTo, newDeprecatedMessage, remove, removePhantomFlag, resolvePath, resolvePath, setDirtyFlags, setFlags, setForceDirty, setIsModified, setIsMoved, setIsNew, setIsRemoved, setReadOnly, setValue, setValue, setValueDeprecation, size, validateType
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public ArrayProperty(Property parent, Field field, int flags)
public ListType getType()
Property
getType
in interface Property
getType
in class ScalarProperty
public boolean isContainer()
Property
Container properties don't have a scalar values. Container values are computed each time they are requested - by
calling on of the getValue
methods - by collecting the values of the child properties.
isContainer
in interface Property
isContainer
in class ScalarProperty
public void setValue(Object value) throws PropertyException
Property
For complex or list properties the value will be set recursively (as a map or list value).
setValue
in interface Property
setValue
in class AbstractProperty
value
- the value to setPropertyException
protected boolean isSameValue(Serializable value1, Serializable value2)
isSameValue
in class AbstractProperty
public boolean isNormalized(Object value)
Property
Null values are considered as normalized.
isNormalized
in interface Property
isNormalized
in class AbstractProperty
value
- the value to checkpublic Serializable normalize(Object value) throws PropertyConversionException
Property
Normalized values are the ones that are used for transportation over the net and that are given to the storage implementation to be stored in the repository
Normalized values must be Serializable
If the given value is already normalized it will be returned back.
normalize
in interface Property
normalize
in class AbstractProperty
value
- the value to normalize according to the property typePropertyConversionException
protected Serializable convert(Collection<?> value) throws PropertyConversionException
PropertyConversionException
public <T> T convertTo(Serializable value, Class<T> toType) throws PropertyConversionException
Property
If the value has already the given type it will be returned back.
convertTo
in interface Property
convertTo
in class AbstractProperty
value
- the normalized value to converttoType
- the conversion typePropertyConversionException
- if the conversion cannot be made because of type incompatibilitiespublic Object newInstance()
Property
Empty is used in the sense of a value that has not been initialized or can be considered as an empty value. For
example for the String
type the empty value will be the empty string ""
newInstance
in interface Property
newInstance
in class AbstractProperty
protected boolean[] getChildDirty()
public boolean isDirty(int index)
public void clearDirtyFlags()
Property
Dirty flags are removed according to the type of the modifications. This way if the property was REMOVED it becomes a PHANTOM otherwise all dirty flags are cleared.
This method should be used by storage implementors to notify the property it should reset its dirty flags. Note that clearing dirty flags is not propagated to the parent property or to children. You need to clear dirty flags explicitly for each property.
clearDirtyFlags
in interface Property
clearDirtyFlags
in class AbstractProperty
Copyright © 2017 Nuxeo. All rights reserved.