public class ScalarProperty extends AbstractProperty
Modifier and Type | Field and Description |
---|---|
protected Field |
field
The corresponding field.
|
protected Serializable |
value |
flags, forceDirty, IS_READONLY, parent
DIRTY_MASK, IS_DIRTY, IS_MODIFIED, IS_MOVED, IS_NEW, IS_PHANTOM, IS_REMOVED, NONE
Constructor and Description |
---|
ScalarProperty(Property parent,
Field field) |
ScalarProperty(Property parent,
Field field,
int flags) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PropertyVisitor visitor,
Object arg)
Method that implement the visitor pattern.
|
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.
|
Object |
clone() |
Property |
get(int index)
Get the child property given it's index.
|
Property |
get(String name)
Gets the child property having the given name.
|
Collection<Property> |
getChildren()
Get a collection over the children properties.
|
Iterator<Property> |
getDirtyChildren()
Gets an iterator over the dirty children properties.
|
Field |
getField()
Gets the field corresponding to this property.
|
String |
getName()
Gets the property name.
|
Type |
getType()
Get the type of the field corresponding to this property.
|
Serializable |
internalGetValue() |
void |
internalSetValue(Serializable value)
Sets the given normalized value.
|
boolean |
isContainer()
Whether this property is a container - this means the property value is a map or a list.
|
boolean |
isSameAs(Property property)
Compare the two properties by content.
|
String |
toString() |
appendDirtyFlags, areFlagsSet, clearDirtyFlags, clearFlags, collectPath, convertTo, getDefaultValue, getDirtyFlags, getObjectResolver, getParent, getPath, getRoot, getSchema, getValue, getValue, getValue, getValue, getValueForWrite, init, isComplex, isDirty, isForceDirty, isList, isModified, isMoved, isNew, isNormalized, isPhantom, isReadOnly, isRemoved, isSameValue, isScalar, iterator, moveTo, newInstance, normalize, remove, removePhantomFlag, resolvePath, resolvePath, setDirtyFlags, setFlags, setForceDirty, setIsModified, setIsMoved, setIsNew, setIsRemoved, setReadOnly, setValue, setValue, setValue, size, validateType
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected Serializable value
public ScalarProperty(Property parent, Field field)
public ScalarProperty(Property parent, Field field, int flags)
public void internalSetValue(Serializable value) throws PropertyException
AbstractProperty
This applies only for nodes that physically store a value (that means non container nodes). Container nodes does nothing.
internalSetValue
in class AbstractProperty
PropertyException
public String getName()
Property
public Type getType()
Property
public Serializable internalGetValue() throws PropertyException
internalGetValue
in class AbstractProperty
PropertyException
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.
public Collection<Property> getChildren()
Property
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.
public 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 Property get(String name)
Property
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.
name
- the child property name (the full name including the prefix if any)public 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()
.
index
- the position to insert the valuepublic Property addEmpty()
Property
This method is useful to construct lists.
public Field getField()
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
public final Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void accept(PropertyVisitor visitor, Object arg) throws PropertyException
Property
The visitor must return null to stop visiting children otherwise a context object that will be passed as the arg argument to children
visitor
- the visitor to acceptarg
- an argument passed to the visitor. This should be used by the visitor to carry on the visiting
context.PropertyException
public boolean isSameAs(Property property) throws PropertyException
Property
PropertyException
PropertyException
public Iterator<Property> getDirtyChildren()
Property
public String toString()
toString
in class AbstractProperty
Copyright © 2016 Nuxeo SA. All rights reserved.