org.spicefactory.pimento.type
Class AssociationType
java.lang.Object
org.spicefactory.pimento.type.AbstractAssociationType
org.spicefactory.pimento.type.AssociationType
- All Implemented Interfaces:
- PropertyType
public class AssociationType
- extends AbstractAssociationType
Represents a ManyToOne or OneToOne association.
- Author:
- Jens Halm
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AssociationType
public AssociationType()
getValueForSnapshot
public Object getValueForSnapshot(Object entity,
Property property,
IoContext context,
FetchMode fetchMode)
- Description copied from interface:
PropertyType
- Reads the specified property from the given entity and returns it in a form
suitable for inclusion in an entity snapshot. For associations this means
that non-null values should be converted to snapshots themselves, using the
provided
IoContext instance. Simple values
could be returned as-is in most cases.
- Parameters:
entity - the entity to extract the property value fromproperty - the property to extractcontext - the active IoContextfetchMode - the fetchMode to use if the property type is an association
- 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,
Property property,
IoContext context,
boolean createChangeSet)
- Description copied from interface:
PropertyType
- 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
EntityUpdate
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 forvalue - the new value for the propertyproperty - the property to preparecontext - the active IoContextcreateChangeSet - whether a change set is being created
- Returns:
- the (possibly converted) value of the property as it will later be applied to the entity.