org.alfresco.repo.domain
Class PropertyValue

java.lang.Object
  extended by org.alfresco.repo.domain.PropertyValue
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AVMNodePropertyEntity, AVMStorePropertyEntity

public class PropertyValue
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Immutable property value storage class.

As of 2.2.1, this class is only used by the AVM persistence layers.

See Also:
Serialized Form

Constructor Summary
PropertyValue()
          default constructor
PropertyValue(org.alfresco.service.namespace.QName typeQName, java.io.Serializable value)
          Construct a new property value.
 
Method Summary
 java.lang.Object clone()
           
static int convertToTypeOrdinal(org.alfresco.service.namespace.QName typeQName)
          Given an actual type qualified name, returns the int ordinal number that represents it in the database.
 boolean equals(java.lang.Object obj)
           
 java.lang.Integer getActualType()
           
 java.lang.String getActualTypeString()
           
 boolean getBooleanValue()
           
 java.util.Collection getCollection(org.alfresco.service.namespace.QName typeQName)
          Gets the value or values as a guaranteed collection.
 double getDoubleValue()
           
 float getFloatValue()
           
 long getLongValue()
           
 java.lang.Integer getPersistedType()
           
 java.io.Serializable getSerializableValue()
           
 java.lang.String getStringValue()
           
 java.io.Serializable getValue(org.alfresco.service.namespace.QName typeQName)
          Fetches the value as a desired type.
 int hashCode()
           
 boolean isMultiValued()
           
 void setActualType(java.lang.Integer actualType)
           
 void setBooleanValue(boolean value)
           
 void setDoubleValue(double value)
           
 void setFloatValue(float value)
           
 void setLongValue(long value)
           
 void setMultiValued(boolean isMultiValued)
           
 void setPersistedType(java.lang.Integer persistedType)
           
 void setPersistedValue(org.alfresco.repo.domain.PropertyValue.ValueType persistedType, java.io.Serializable value)
          Stores the value in the correct slot based on the type of persistence requested.
 void setSerializableValue(java.io.Serializable value)
           
 void setStringValue(java.lang.String value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyValue

public PropertyValue()
default constructor


PropertyValue

public PropertyValue(org.alfresco.service.namespace.QName typeQName,
                     java.io.Serializable value)
Construct a new property value.

Parameters:
typeQName - the dictionary-defined property type to store the property as. May be null in which case the type will be determined from the value parameter.
value - the value to store. This will be converted into a format compatible with the type given
Throws:
java.lang.UnsupportedOperationException - if the value cannot be converted to the type given
Method Detail

convertToTypeOrdinal

public static int convertToTypeOrdinal(org.alfresco.service.namespace.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.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getActualType

public java.lang.Integer getActualType()

getActualTypeString

public java.lang.String getActualTypeString()
Returns:
Returns the actual type's String representation

setActualType

public void setActualType(java.lang.Integer actualType)

isMultiValued

public boolean isMultiValued()

setMultiValued

public void setMultiValued(boolean isMultiValued)

getPersistedType

public java.lang.Integer getPersistedType()

setPersistedType

public void setPersistedType(java.lang.Integer persistedType)

setPersistedValue

public void setPersistedValue(org.alfresco.repo.domain.PropertyValue.ValueType persistedType,
                              java.io.Serializable value)
Stores the value in the correct slot based on the type of persistence requested. No conversion is done.

Parameters:
persistedType - the value type
value - the value - it may only be null if the persisted type is ValueType#NULL

getValue

public java.io.Serializable getValue(org.alfresco.service.namespace.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 Collection of values of the required type
Throws:
org.alfresco.error.AlfrescoRuntimeException - if the type given is not recognized
org.alfresco.service.cmr.repository.datatype.TypeConversionException - if the conversion to the required type fails
See Also:
The static qualified names for the types

getCollection

public java.util.Collection getCollection(org.alfresco.service.namespace.QName typeQName)
Gets the value or values as a guaranteed collection.

See Also:
PropertyValue.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 java.lang.String getStringValue()

setStringValue

public void setStringValue(java.lang.String value)

getSerializableValue

public java.io.Serializable getSerializableValue()

setSerializableValue

public void setSerializableValue(java.io.Serializable value)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.