Package org.alfresco.repo.domain.node
Class NodePropertyValue
- java.lang.Object
-
- org.alfresco.repo.domain.node.NodePropertyValue
-
- All Implemented Interfaces:
Serializable,Cloneable
public class NodePropertyValue extends Object implements Cloneable, Serializable
Immutable property value storage class.- Since:
- 3.4
- Author:
- Derek Hulley
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static SerializableEMPTY_COLLECTION_VALUEused to provide empty collection values in and outstatic Set<Class<?>>IMMUTABLE_CLASSESImmutable classes in addition toValueProtectingMap.DEFAULT_IMMUTABLE_CLASSESContentData ContentDataId NodeRef ChildAssociationRef AssociationRef QName VersionNumber Period
-
Constructor Summary
Constructors Constructor Description NodePropertyValue()default constructorNodePropertyValue(QName typeQName, Serializable value)Construct a new property value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()static intconvertToTypeOrdinal(QName typeQName)Given an actual type qualified name, returns the int ordinal number that represents it in the database.booleanequals(Object obj)IntegergetActualType()StringgetActualTypeString()booleangetBooleanValue()Collection<Serializable>getCollection(QName typeQName)Gets the value or values as a guaranteed collection.doublegetDoubleValue()floatgetFloatValue()longgetLongValue()IntegergetPersistedType()SerializablegetSerializableValue()StringgetStringValue()SerializablegetValue(QName typeQName)Fetches the value as a desired type.inthashCode()static booleanisDataTypeSupported(QName typeQName)If property value of the typeQNameis supportedvoidsetActualType(Integer actualType)voidsetBooleanValue(boolean value)voidsetDoubleValue(double value)voidsetFloatValue(float value)voidsetLongValue(long value)voidsetPersistedType(Integer persistedType)voidsetPersistedValue(org.alfresco.repo.domain.node.NodePropertyValue.ValueType persistedType, Serializable value)Stores the value in the correct slot based on the type of persistence requested.voidsetSerializableValue(Serializable value)voidsetStringValue(String value)StringtoString()
-
-
-
Field Detail
-
EMPTY_COLLECTION_VALUE
public static final Serializable EMPTY_COLLECTION_VALUE
used to provide empty collection values in and out
-
IMMUTABLE_CLASSES
public static final Set<Class<?>> IMMUTABLE_CLASSES
Immutable classes in addition toValueProtectingMap.DEFAULT_IMMUTABLE_CLASSES- ContentData
- ContentDataId
- NodeRef
- ChildAssociationRef
- AssociationRef
- QName
- VersionNumber
- Period
-
-
Constructor Detail
-
NodePropertyValue
public NodePropertyValue()
default constructor
-
NodePropertyValue
public NodePropertyValue(QName typeQName, Serializable value)
Construct a new property value.- Parameters:
typeQName- the dictionary-defined property type to store the property asvalue- the value to store. This will be converted into a format compatible with the type given- Throws:
UnsupportedOperationException- if the value cannot be converted to the type given
-
-
Method Detail
-
convertToTypeOrdinal
public static int convertToTypeOrdinal(QName typeQName)
Given an actual type qualified name, returns the int ordinal number that represents it in the database.- Parameters:
typeQName- the type qualified name- Returns:
- Returns the int representation of the type, e.g. CONTENT.getOrdinalNumber() for type d:content.
-
isDataTypeSupported
public static boolean isDataTypeSupported(QName typeQName)
If property value of the typeQNameis supported- Parameters:
typeQName- the type qualified name
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
getActualType
public Integer getActualType()
-
getActualTypeString
public String getActualTypeString()
- Returns:
- Returns the actual type's String representation
-
setActualType
public void setActualType(Integer actualType)
-
getPersistedType
public Integer getPersistedType()
-
setPersistedType
public void setPersistedType(Integer persistedType)
-
setPersistedValue
public void setPersistedValue(org.alfresco.repo.domain.node.NodePropertyValue.ValueType persistedType, Serializable value)Stores the value in the correct slot based on the type of persistence requested. No conversion is done.- Parameters:
persistedType- the value typevalue- the value - it may only be null if the persisted type isValueType#NULL
-
getValue
public Serializable getValue(QName typeQName)
Fetches the value as a desired type. Collections (i.e. multi-valued properties) will be converted as a whole to ensure that all the values returned within the collection match the given type.- Parameters:
typeQName- the type required for the return value- Returns:
- Returns the value of this property as the desired type, or a
Collectionof values of the required type - Throws:
AlfrescoRuntimeException- if the type given is not recognizedTypeConversionException- if the conversion to the required type fails- See Also:
The static qualified names for the types
-
getCollection
public Collection<Serializable> getCollection(QName typeQName)
Gets the value or values as a guaranteed collection.- See Also:
getValue(QName)
-
getBooleanValue
public boolean getBooleanValue()
-
setBooleanValue
public void setBooleanValue(boolean value)
-
getLongValue
public long getLongValue()
-
setLongValue
public void setLongValue(long value)
-
getFloatValue
public float getFloatValue()
-
setFloatValue
public void setFloatValue(float value)
-
getDoubleValue
public double getDoubleValue()
-
setDoubleValue
public void setDoubleValue(double value)
-
getStringValue
public String getStringValue()
-
setStringValue
public void setStringValue(String value)
-
getSerializableValue
public Serializable getSerializableValue()
-
setSerializableValue
public void setSerializableValue(Serializable value)
-
-