Class BlobProperty
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Property>
,Map<String,
,Property> Property
Blob
object.- See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.api.model.impl.MapProperty
field
Fields inherited from class org.nuxeo.ecm.core.api.model.impl.ComplexProperty
children
Fields inherited from class org.nuxeo.ecm.core.api.model.impl.AbstractProperty
flags, forceDirty, IS_DEPRECATED, IS_READONLY, IS_SECURED, NON_CANON_INDEX, parent
Fields 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
-
Method Summary
Modifier and TypeMethodDescription<T> T
convertTo
(Serializable value, Class<T> toType) Converts the given normalized value to the given type.protected Object
getMemberValue
(Object object, String name) 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.void
internalSetValue
(Serializable value) Sets the given normalized value.boolean
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.protected boolean
isNullOrSameValue
(Serializable value1, Serializable value2) boolean
Should be used by container properties.protected boolean
isSameValue
(Serializable value1, Serializable value2) protected boolean
isSameValue
(ManagedBlob value1, ManagedBlob value2) Creates a new and empty instance of a normalized value.Normalizes the given value as dictated by the property type.protected void
protected void
setMemberValue
(Object object, String name, Object value) protected void
setMemberValue
(Blob blob, String name, Object value) void
Sets this property value.Methods inherited from class org.nuxeo.ecm.core.api.model.impl.MapProperty
accept, clone, getField, getName, getType
Methods inherited from class org.nuxeo.ecm.core.api.model.impl.ComplexProperty
addEmpty, addValue, addValue, clear, clearDirtyFlags, containsKey, containsValue, entrySet, get, get, get, getChild, getChildren, getDirtyChildren, getNonPhantomChild, getNonPhantomChildren, isEmpty, keySet, put, putAll, remove, set, values, visitChildren
Methods inherited from class org.nuxeo.ecm.core.api.model.impl.AbstractProperty
appendDirtyFlags, areFlagsSet, clearFlags, collectPath, computeRemovedProperty, getDeprecatedFallback, getDeprecatedParent, getDirtyFlags, getObjectResolver, getParent, getRoot, getSchema, getValue, getValue, getValue, getValue, getValueDeprecation, getXPath, getXPath, hasDefaultValue, isComplex, isDeprecated, isDirty, isForceDirty, isList, isModified, isMoved, isNew, isPhantom, isReadOnly, isRemoved, isScalar, isSecured, isSecuredForContext, iterator, moveTo, newDeprecatedMessage, remove, removePhantomFlag, resolvePath, resolvePath, setDirtyFlags, setFlags, setForceDirty, setIsModified, setIsMoved, setIsNew, setIsRemoved, setReadOnly, setValue, setValue, setValueDeprecation, size, toString, validateType
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll, size
-
Field Details
-
value
-
-
Constructor Details
-
BlobProperty
-
-
Method Details
-
getDefaultValue
- Overrides:
getDefaultValue
in classComplexProperty
-
internalGetValue
- Overrides:
internalGetValue
in classComplexProperty
- Throws:
PropertyException
-
internalSetValue
Description copied from class:AbstractProperty
Sets the given normalized value.This applies only for nodes that physically store a value (that means non container nodes). Container nodes does nothing.
- Overrides:
internalSetValue
in classMapProperty
- Throws:
PropertyException
-
isNormalized
Description copied from interface:Property
Checks if the given value is a normalized one. This means the value has a type that is normalized.Null values are considered as normalized.
- Specified by:
isNormalized
in interfaceProperty
- Overrides:
isNormalized
in classComplexProperty
- Parameters:
value
- the value to check- Returns:
- true if the value is normalized false otherwise
-
normalize
Description copied from interface:Property
Normalizes the given value as dictated by the property type.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.
- Specified by:
normalize
in interfaceProperty
- Overrides:
normalize
in classComplexProperty
- Parameters:
value
- the value to normalize according to the property type- Returns:
- the normalized value
- Throws:
PropertyConversionException
-
convertTo
Description copied from interface:Property
Converts the given normalized value to the given type.If the value has already the given type it will be returned back.
- Specified by:
convertTo
in interfaceProperty
- Overrides:
convertTo
in classAbstractProperty
- Parameters:
value
- the normalized value to converttoType
- the conversion type- Returns:
- the converted value, which may be null
- Throws:
PropertyConversionException
- if the conversion cannot be made because of type incompatibilities
-
newInstance
Description copied from interface:Property
Creates a new and empty instance of a normalized value.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 ""- Specified by:
newInstance
in interfaceProperty
- Overrides:
newInstance
in classAbstractProperty
- Returns:
- the empty instance the empty instance, or null for some implementations
-
isContainer
public boolean isContainer()Description copied from interface:Property
Whether 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
getValue
methods - by collecting the values of the child properties.- Specified by:
isContainer
in interfaceProperty
- Overrides:
isContainer
in classMapProperty
- Returns:
- true if scalar false otherwise
-
setValue
Description copied from interface:Property
Sets this property value. The value will be first normalized and then set.For complex or list properties the value will be set recursively (as a map or list value).
- Specified by:
setValue
in interfaceProperty
- Overrides:
setValue
in classComplexProperty
- Parameters:
value
- the value to set- Throws:
InvalidPropertyValueException
- if the given value type is not compatible with the expected value typePropertyException
-
isSameValue
- Overrides:
isSameValue
in classAbstractProperty
-
isSameValue
-
isNullOrSameValue
-
init
Description copied from interface:Property
Initializes the property with the given normalized value.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.
- Specified by:
init
in interfaceProperty
- Overrides:
init
in classComplexProperty
- Parameters:
value
- the normalized value to set- Throws:
PropertyException
-
getValueForWrite
Description copied from interface:Property
Gets the property normalized value for write.Can be different fropm
Property.getValue()
in cases where the property adapts the value it is given to store.- Specified by:
getValueForWrite
in interfaceProperty
- Overrides:
getValueForWrite
in classComplexProperty
- Returns:
- the property value to use for write, which may be null
- Throws:
PropertyException
-
internalGetChild
Description copied from class:ComplexProperty
Gets the property given its name. If the property was not set, returns null.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.
- Overrides:
internalGetChild
in classComplexProperty
- Returns:
- the child. Cannot return null
-
setMap
- Throws:
PropertyException
-
setMemberValue
protected void setMemberValue(Blob blob, String name, Object value) throws PropertyNotFoundException - Throws:
PropertyNotFoundException
-
getMemberValue
- Throws:
PropertyException
-
setMemberValue
- Throws:
PropertyException
-
isSameAs
Description copied from class:ComplexProperty
Should be used by container properties. Non container props must overwrite this.- Specified by:
isSameAs
in interfaceProperty
- Overrides:
isSameAs
in classComplexProperty
- Returns:
- true If the properties have a similar content, otherwise false
- Throws:
PropertyException
-