org.spicefactory.pimento.property
Class AbstractUnindexedCollectionHandler

java.lang.Object
  extended by org.spicefactory.pimento.property.AbstractAssociationHandler
      extended by org.spicefactory.pimento.property.AbstractCollectionHandler
          extended by org.spicefactory.pimento.property.AbstractUnindexedCollectionHandler
All Implemented Interfaces:
PropertyHandler
Direct Known Subclasses:
BagHandler, MapHandler, SetHandler

public abstract class AbstractUnindexedCollectionHandler
extends AbstractCollectionHandler

Base class for property handlers that manage unindexed collections.

Author:
Jens Halm

Field Summary
 
Fields inherited from class org.spicefactory.pimento.property.AbstractAssociationHandler
property
 
Constructor Summary
AbstractUnindexedCollectionHandler()
           
 
Method Summary
protected  void applyCollectionUpdate(Object entity, CollectionUpdate update, Property property)
          Applies the specified collection update to the property of the given entity.
protected  CollectionUpdate createCollectionUpdate(CollectionChangeSet changeSet, SnapshotDecoder decoder)
          Creates a CollectionUpdate instance from the specified change set.
 Object prepareValueFromSnapshot(Object entity, Object value, SnapshotDecoder decoder, EntityState state)
          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.
 
Methods inherited from class org.spicefactory.pimento.property.AbstractCollectionHandler
addSupportedInterface, createCollection, createFullCollectionFromSnapshots, getCollection, getValueForSnapshot
 
Methods inherited from class org.spicefactory.pimento.property.AbstractAssociationHandler
entityForInstance, entityForSnapshot, equals, getAssociationModel, getFetchPlan, init, setAssociationModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractUnindexedCollectionHandler

public AbstractUnindexedCollectionHandler()
Method Detail

prepareValueFromSnapshot

public Object prepareValueFromSnapshot(Object entity,
                                       Object value,
                                       SnapshotDecoder decoder,
                                       EntityState state)
Description copied from interface: PropertyHandler
Prepares the specified property value, performing all necessary conversions, but without actually applying it to the specified entity. The prepared values will be collected in a PropertyChangeSet instance which gets passed to any configured interceptors before the property is applied with the setValue method of this class.

Parameters:
entity - the entity to prepare the property for
value - the new value for the property
decoder - the decoder to use for decoding associations
state - the state of the entity
Returns:
the (possibly converted) value of the property as it will later be applied to the entity.

createCollectionUpdate

protected CollectionUpdate createCollectionUpdate(CollectionChangeSet changeSet,
                                                  SnapshotDecoder decoder)
Creates a CollectionUpdate instance from the specified change set. CollectionUpdate instances get passed to the configured interceptors before the change set is applied with applyCollectionUpdate. While the specified change set contains entity snapshots the returned CollectionUpdate must contain the corresponding persistent entities.

Parameters:
changeSet - the change set to convert
decoder - the decoder to use for the snapshots in the change set
Returns:
a CollectionUpdate instance created from the specified change set

setValue

public void setValue(Object entity,
                     Object value)
Description copied from interface: PropertyHandler
Sets the specified property value of the given entity. This method can safely assume that the value has been property prepared (possibly converted) with the prepareValueFromSnapshot method of this class before this method gets invoked.

Specified by:
setValue in interface PropertyHandler
Overrides:
setValue in class AbstractAssociationHandler
Parameters:
entity - the entity to set the property for
value - the new value for the property

applyCollectionUpdate

protected void applyCollectionUpdate(Object entity,
                                     CollectionUpdate update,
                                     Property property)
Applies the specified collection update to the property of the given entity.

Parameters:
entity - the entity the update should be applied to
update - the collection update to apply
property - the property of the entity that the update should be applied to