public class BlobProperty extends MapProperty
Blob
object.Modifier and Type | Class and Description |
---|---|
static class |
BlobProperty.ScalarMemberProperty |
Modifier and Type | Field and Description |
---|---|
protected Serializable |
value |
field
children
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 |
---|
BlobProperty(Property parent,
Field field,
int flags) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
<T> T |
convertTo(Serializable value,
Class<T> toType)
Converts the given normalized value to the given type.
|
Serializable |
getDefaultValue() |
protected Object |
getMemberValue(Object object,
String name) |
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() |
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 |
isNormalized(Object value)
Checks if the given value is a normalized one.
|
boolean |
isSameAs(Property property)
Should be used by container properties.
|
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.
|
protected void |
setMap(Object object,
Map<String,Object> value) |
protected void |
setMemberValue(Blob blob,
String name,
Object value) |
protected void |
setMemberValue(Object object,
String name,
Object value) |
void |
setValue(Object value)
Sets this property value.
|
accept, getField, getName, getType
addEmpty, addValue, addValue, clear, clearDirtyFlags, containsKey, containsValue, entrySet, get, get, get, getChild, getChildren, getDirtyChildren, getNonPhantomChild, getNonPhantomChildren, isEmpty, keySet, put, putAll, remove, values, visitChildren
appendDirtyFlags, areFlagsSet, clearFlags, collectPath, computeRemovedProperty, getDeprecatedParent, getDirtyFlags, getObjectResolver, getParent, getPath, getRoot, getSchema, getValue, getValue, getValue, getValue, getValueDeprecation, getXPath, getXPath, 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, toString, validateType
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll, size
forEach, spliterator
protected Serializable value
public BlobProperty(Property parent, Field field, int flags)
public Serializable getDefaultValue()
getDefaultValue
in class ComplexProperty
public Serializable internalGetValue() throws PropertyException
internalGetValue
in class ComplexProperty
PropertyException
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 MapProperty
PropertyException
public final Object clone() throws CloneNotSupportedException
clone
in class MapProperty
CloneNotSupportedException
public boolean isNormalized(Object value)
Property
Null values are considered as normalized.
isNormalized
in interface Property
isNormalized
in class ComplexProperty
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 ComplexProperty
value
- the value to normalize according to the property typePropertyConversionException
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
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 MapProperty
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 ComplexProperty
value
- the value to setPropertyException
protected boolean isSameValue(Serializable value1, Serializable value2)
isSameValue
in class AbstractProperty
public void init(Serializable value) throws PropertyException
Property
The 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 Property
init
in class ComplexProperty
value
- the normalized value to setPropertyException
public 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 Property
getValueForWrite
in class ComplexProperty
PropertyException
protected Property internalGetChild(Field field)
ComplexProperty
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.
internalGetChild
in class ComplexProperty
protected void setMap(Object object, Map<String,Object> value) throws PropertyException
PropertyException
protected void setMemberValue(Blob blob, String name, Object value) throws PropertyNotFoundException
PropertyNotFoundException
protected Object getMemberValue(Object object, String name) throws PropertyException
PropertyException
protected void setMemberValue(Object object, String name, Object value) throws PropertyException
PropertyException
public boolean isSameAs(Property property) throws PropertyException
ComplexProperty
isSameAs
in interface Property
isSameAs
in class ComplexProperty
PropertyException
PropertyException
Copyright © 2018 Nuxeo. All rights reserved.