org.spicefactory.pimento.metadata
Class EmbeddedPropertyMetadata

java.lang.Object
  extended by org.spicefactory.pimento.metadata.PropertyMetadata
      extended by org.spicefactory.pimento.metadata.EmbeddedPropertyMetadata
All Implemented Interfaces:
Externalizable

public class EmbeddedPropertyMetadata
extends PropertyMetadata

The metadata for a single property of an embedded property of a persistent entity.

Author:
Jens Halm

Constructor Summary
EmbeddedPropertyMetadata()
          Creates a new instance.
EmbeddedPropertyMetadata(String name, PropertyType type, Property property, Property ownerProperty)
          Creates a new instance.
 
Method Summary
 Object getValue(Object entity)
          Retrieve the value of this property for the specified entity.
 Object getValueForSnapshot(Object entity, IoContext context, FetchMode fetchMode)
          Reads the specified property from the given entity and returns it in a form suitable for inclusion in an entity snapshot.
 Object prepareValueFromSnapshot(Object entity, Object value, IoContext context, boolean createChangeSet)
          Prepares the specified property value, performing all necessary conversions, but without actually applying it to the specified entity.
 void setValue(Object entity, Object value)
          Sets the specified property value of the given entity.
 void writeExternal(DataOutput output)
          Saves the content of this object to the DataOutput instance.
 
Methods inherited from class org.spicefactory.pimento.metadata.PropertyMetadata
convertValue, getName, isReadOnly, isRefreshable, readExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedPropertyMetadata

public EmbeddedPropertyMetadata()
Creates a new instance.


EmbeddedPropertyMetadata

public EmbeddedPropertyMetadata(String name,
                                PropertyType type,
                                Property property,
                                Property ownerProperty)
Creates a new instance.

Parameters:
name - the name of the property
type - the type of the property
property - the reflection instance
ownerProperty - the embedded property of the persistent entity
Method Detail

getValue

public Object getValue(Object entity)
Description copied from class: PropertyMetadata
Retrieve the value of this property for the specified entity.

Overrides:
getValue in class PropertyMetadata
Parameters:
entity - the entity to retrieve the value for
Returns:
the value of this property in the specified entity

getValueForSnapshot

public Object getValueForSnapshot(Object entity,
                                  IoContext context,
                                  FetchMode fetchMode)
Description copied from class: PropertyMetadata
Reads the specified property from the given entity and returns it in a form suitable for inclusion in an entity snapshot.

Overrides:
getValueForSnapshot in class PropertyMetadata
Parameters:
entity - the entity to extract the property value from
context - the active IoContext
fetchMode - the fetch mode to use
Returns:
the current value of the property as a simple value, an entity snapshot or an instance of PropertyState

prepareValueFromSnapshot

public Object prepareValueFromSnapshot(Object entity,
                                       Object value,
                                       IoContext context,
                                       boolean createChangeSet)
Description copied from class: PropertyMetadata
Prepares the specified property value, performing all necessary conversions, but without actually applying it to the specified entity.

Overrides:
prepareValueFromSnapshot in class PropertyMetadata
Parameters:
entity - the entity to prepare the property for
value - the new value for the property
context - the active IoContext
createChangeSet - whether a change set is being created
Returns:
the (possibly converted) value of the property as it will later be applied to the entity.

setValue

public void setValue(Object entity,
                     Object value)
Description copied from class: PropertyMetadata
Sets the specified property value of the given entity.

Overrides:
setValue in class PropertyMetadata
Parameters:
entity - the entity to set the property for
value - the new value for the property

writeExternal

public void writeExternal(DataOutput output)
Description copied from interface: Externalizable
Saves the content of this object to the DataOutput instance.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class PropertyMetadata
Parameters:
output - the output to write to