Class ScalarProperty
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Property>,Property
- Direct Known Subclasses:
ArrayProperty,BinaryProperty,BlobProperty.ScalarMemberProperty,BooleanProperty,DateProperty,DoubleProperty,LongProperty,StringProperty
- Author:
- Bogdan Stefanescu
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FieldThe corresponding field.protected SerializableFields inherited from class org.nuxeo.ecm.core.api.model.impl.AbstractProperty
flags, forceDirty, IS_DEPRECATED, IS_READONLY, IS_SECURED, NON_CANON_INDEX, parentFields inherited from interface org.nuxeo.ecm.core.api.model.Property
DIRTY_MASK, IS_DIRTY, IS_MODIFIED, IS_MOVED, IS_NEW, IS_PHANTOM, IS_REMOVED, NONE -
Constructor Summary
ConstructorsConstructorDescriptionScalarProperty(Property parent, Field field) ScalarProperty(Property parent, Field field, int flags) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(PropertyVisitor visitor, Object arg) Method that implement the visitor pattern.addEmpty()Creates an empty child property and adds it as a property to the list container.Inserts at the given position a new value to the list.Appends a new value to the list.final Objectclone()get(int index) Get the child property given it's index.Gets the child property having the given name.Get a collection over the children properties.Gets an iterator over the dirty children properties.getField()Gets the field corresponding to this property.getName()Gets the property name.getType()Get the type of the field corresponding to this property.voidinternalSetValue(Serializable value) Sets the given normalized value.booleanWhether this property is a container - this means the property value is a map or a list.booleanCompare the two properties by content.voidSets the child property having the given name.toString()Methods inherited from class org.nuxeo.ecm.core.api.model.impl.AbstractProperty
appendDirtyFlags, areFlagsSet, clearDirtyFlags, clearFlags, collectPath, computeRemovedProperty, convertTo, getDefaultValue, getDeprecatedFallback, getDeprecatedParent, getDirtyFlags, getObjectResolver, getParent, getRoot, getSchema, getValue, getValue, getValue, getValue, getValueDeprecation, getValueForWrite, getXPath, getXPath, hasDefaultValue, init, isComplex, isDeprecated, isDirty, isForceDirty, isList, isModified, isMoved, isNew, isNormalized, isPhantom, isReadOnly, isRemoved, isSameValue, isScalar, isSecured, isSecuredForContext, iterator, moveTo, newDeprecatedMessage, newInstance, normalize, remove, removePhantomFlag, resolvePath, resolvePath, setDirtyFlags, setFlags, setForceDirty, setIsModified, setIsMoved, setIsNew, setIsRemoved, setReadOnly, setValue, setValue, setValue, setValueDeprecation, size, validateTypeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
field
The corresponding field. -
value
-
-
Constructor Details
-
ScalarProperty
-
ScalarProperty
-
-
Method Details
-
internalSetValue
Description copied from class:AbstractPropertySets the given normalized value.This applies only for nodes that physically store a value (that means non container nodes). Container nodes does nothing.
- Specified by:
internalSetValuein classAbstractProperty- Throws:
PropertyException
-
getName
Description copied from interface:PropertyGets the property name.- Returns:
- the property name
-
getType
Description copied from interface:PropertyGet the type of the field corresponding to this property.- Returns:
- the property type
-
internalGetValue
- Specified by:
internalGetValuein classAbstractProperty- Throws:
PropertyException
-
isContainer
public boolean isContainer()Description copied from interface:PropertyWhether this property is a container - this means the property value is a map or a list.Container properties don't have a scalar values. Container values are computed each time they are requested - by calling on of the
getValuemethods - by collecting the values of the child properties.- Returns:
- true if scalar false otherwise
-
getChildren
Description copied from interface:PropertyGet a collection over the children properties. This includes all children including phantom ones (those who are not yet set by the user).The 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.
- Returns:
- the children properties
-
get
Description copied from interface:PropertyGet the child property given it's index. This operation is mandatory for List properties.If this method is not supported an
UnsupportedOperationExceptionmust be thrownRelative paths are not resolved. THis method is intended to lookup direct chilren. For path lookups, use
Property.resolvePath(String)instead.- Returns:
- the child property if any null if no child property with that name is found or if the property is a scalar
-
get
Description copied from interface:PropertyGets the child property having the given name.If 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.- Parameters:
name- the child property name (the full name including the prefix if any)- Returns:
- the child property if any null if no child property with that name is found or if the property is a scalar
-
set
Description copied from interface:PropertySets the child property having the given name.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.- Parameters:
name- the child property name (the full name including the prefix if any)property- the child property to set- Throws:
PropertyNotFoundException- if the child property is not found in the type definitionPropertyException
-
addValue
Description copied from interface:PropertyAppends a new value to the list. A new property will be created to store the given value and appended to the children list.The created property will be marked as
Property.isNew().- Returns:
- the added property
-
addValue
Description copied from interface:PropertyInserts at the given position a new value to the list. A new property will be created to store the given value and appended to the children list.The created property will be marked as
Property.isNew().- Parameters:
index- the position to insert the value- Returns:
- the added property
-
addEmpty
Description copied from interface:PropertyCreates an empty child property and adds it as a property to the list container.This method is useful to construct lists.
- Returns:
- the created property
-
getField
Description copied from interface:PropertyGets the field corresponding to this property.The field is the object defining the property. You can see the field as a java class and the property as a class instance
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
accept
Description copied from interface:PropertyMethod that implement the visitor pattern.The visitor must return null to stop visiting children otherwise a context object that will be passed as the arg argument to children
- Parameters:
visitor- the visitor to acceptarg- an argument passed to the visitor. This should be used by the visitor to carry on the visiting context.- Throws:
PropertyException
-
isSameAs
Description copied from interface:PropertyCompare the two properties by content.- Returns:
- true If the properties have a similar content, otherwise false
- Throws:
PropertyException
-
getDirtyChildren
Description copied from interface:PropertyGets an iterator over the dirty children properties.- Returns:
- the iterator
-
toString
- Overrides:
toStringin classAbstractProperty
-