public abstract class ComplexProperty extends AbstractProperty implements Map<String,Property>
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Property> |
children |
deprecatedFallback, flags, forceDirty, IS_READONLY, isDeprecated, NON_CANON_INDEX, parentDIRTY_MASK, IS_DIRTY, IS_MODIFIED, IS_MOVED, IS_NEW, IS_PHANTOM, IS_REMOVED, NONE| Modifier | Constructor and Description |
|---|---|
protected |
ComplexProperty(Property parent) |
protected |
ComplexProperty(Property parent,
int flags) |
| Modifier and Type | Method and Description |
|---|---|
Property |
addEmpty()
Creates an empty child property and adds it as a property to the list container.
|
Property |
addValue(int index,
Object value)
Inserts at the given position a new value to the list.
|
Property |
addValue(Object value)
Appends a new value to the list.
|
void |
clear()
Throws UnsupportedOperationException, added to implement List
|
void |
clearDirtyFlags()
Notify the property that its changes was stored so it can safely remove dirty flags.
|
boolean |
containsKey(Object key)
Throws UnsupportedOperationException, added to implement List
|
boolean |
containsValue(Object value)
Throws UnsupportedOperationException, added to implement List
|
Set<Map.Entry<String,Property>> |
entrySet() |
Property |
get(int index)
Get the child property given it's index.
|
Property |
get(Object key) |
Property |
get(String name)
Gets the child property having the given name.
|
Property |
getChild(Field field) |
Collection<Property> |
getChildren()
Get a collection over the children properties.
|
protected Serializable |
getDefaultValue() |
Iterator<Property> |
getDirtyChildren()
Gets an iterator over the dirty children properties.
|
Property |
getNonPhantomChild(Field field) |
Collection<Property> |
getNonPhantomChildren() |
abstract ComplexType |
getType()
Get the type of the field corresponding to this property.
|
Serializable |
getValueForWrite()
Gets the property normalized value for write.
|
void |
init(Serializable value)
Initializes the property with the given normalized value.
|
protected Property |
internalGetChild(Field field)
Gets the property given its name.
|
Serializable |
internalGetValue() |
boolean |
isEmpty() |
boolean |
isNormalized(Object value)
Checks if the given value is a normalized one.
|
boolean |
isSameAs(Property property)
Should be used by container properties.
|
Set<String> |
keySet() |
Serializable |
normalize(Object value)
Normalizes the given value as dictated by the property type.
|
Property |
put(String key,
Property value)
Throws UnsupportedOperationException, added to implement List
|
void |
putAll(Map<? extends String,? extends Property> t)
Throws UnsupportedOperationException, added to implement List
|
Property |
remove(Object key)
Throws UnsupportedOperationException, added to implement List
|
void |
setValue(Object value)
Sets this property value.
|
Collection<Property> |
values() |
void |
visitChildren(PropertyVisitor visitor,
Object arg) |
appendDirtyFlags, areFlagsSet, clearFlags, collectPath, computeRemovedProperty, convertTo, getDeprecatedParent, getDirtyFlags, getObjectResolver, getParent, getPath, getRoot, getSchema, getValue, getValue, getValue, getValue, getValueDeprecation, getXPath, getXPath, internalSetValue, isComplex, isDeprecated, isDirty, isForceDirty, isList, isModified, isMoved, isNew, isPhantom, isReadOnly, isRemoved, isSameValue, isScalar, iterator, moveTo, newDeprecatedMessage, newInstance, remove, removePhantomFlag, resolvePath, resolvePath, setDirtyFlags, setFlags, setForceDirty, setIsModified, setIsMoved, setIsNew, setIsRemoved, setReadOnly, setValue, setValue, setValueDeprecation, size, toString, validateTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll, sizeaccept, getField, getName, isContainerforEach, spliteratorprotected ComplexProperty(Property parent)
protected ComplexProperty(Property parent, int flags)
protected Property internalGetChild(Field field)
This method will always be called using a valid property name (a property specified by the schema). The returned property will be cached by its parent so the next time it is needed, it will be reused from the cache. That means this method servers as a initializer for properties - usually you create a new property and return it - you don't need to cache created properties.
If you want to change the way a property is fetched / stored, you must override this method.
UnsupportedOperationExceptionpublic abstract ComplexType getType()
Propertypublic boolean isNormalized(Object value)
PropertyNull values are considered as normalized.
isNormalized in interface PropertyisNormalized in class AbstractPropertyvalue - the value to checkpublic Serializable normalize(Object value) throws PropertyConversionException
PropertyNormalized 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 Propertynormalize in class AbstractPropertyvalue - the value to normalize according to the property typePropertyConversionExceptionpublic Property get(int index)
Property
If this method is not supported an UnsupportedOperationException must be thrown
Relative paths are not resolved. THis method is intended to lookup direct chilren. For path lookups, use
Property.resolvePath(String) instead.
public final Property getNonPhantomChild(Field field)
public final Collection<Property> getNonPhantomChildren()
public Collection<Property> getChildren()
PropertyThe returned collection is ordered for list properties, and unordered for complex properties
Be aware that this method is creating phantom child properties for all schema fields that are not yet set.
getChildren in interface Propertypublic Property get(String name) throws PropertyNotFoundException
PropertyIf the property is a scalar, this will return always null.
The given name should be the full name (i.e. prefixed name if any prefix exists).
If a non prefixed name is given, the first child property having the given local name will be returned.
Relative paths are not resolved. THis method is intended to lookup direct children. For path lookups use
Property.resolvePath(String) instead.
get in interface Propertyname - the child property name (the full name including the prefix if any)PropertyNotFoundExceptionpublic Serializable internalGetValue() throws PropertyException
internalGetValue in class AbstractPropertyPropertyExceptionpublic Serializable getValueForWrite() throws PropertyException
Property
Can be different fropm Property.getValue() in cases where the property adapts the value it is given to store.
getValueForWrite in interface PropertygetValueForWrite in class AbstractPropertyPropertyExceptionpublic void init(Serializable value) throws PropertyException
PropertyThe given value must be normalized - note that no check is done on that.
The phantom flag is unset by this operation.
This method should be used to initialize properties.
init in interface Propertyinit in class AbstractPropertyvalue - the normalized value to setPropertyExceptionprotected Serializable getDefaultValue()
getDefaultValue in class AbstractPropertypublic void setValue(Object value) throws PropertyException
PropertyFor complex or list properties the value will be set recursively (as a map or list value).
setValue in interface PropertysetValue in class AbstractPropertyvalue - the value to setPropertyExceptionpublic Property addValue(Object value)
Property
The created property will be marked as Property.isNew().
public Property addValue(int index, Object value)
Property
The created property will be marked as Property.isNew().
public Property addEmpty()
PropertyThis method is useful to construct lists.
public void visitChildren(PropertyVisitor visitor, Object arg) throws PropertyException
PropertyExceptionpublic boolean isSameAs(Property property) throws PropertyException
isSameAs in interface PropertyPropertyExceptionpublic Iterator<Property> getDirtyChildren()
PropertygetDirtyChildren in interface Propertypublic void clear()
public boolean containsKey(Object key)
containsKey in interface Map<String,Property>public boolean containsValue(Object value)
containsValue in interface Map<String,Property>public Property put(String key, Property value)
public void putAll(Map<? extends String,? extends Property> t)
public Property remove(Object key)
public void clearDirtyFlags()
PropertyDirty 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 PropertyclearDirtyFlags in class AbstractPropertyCopyright © 2019 Nuxeo. All rights reserved.