Class TransformerBasedValueHolder
- java.lang.Object
-
- org.eclipse.persistence.internal.indirection.DatabaseValueHolder
-
- org.eclipse.persistence.internal.indirection.TransformerBasedValueHolder
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ValueHolderInterface
,WeavedAttributeValueHolderInterface
public class TransformerBasedValueHolder extends DatabaseValueHolder
- Since:
- release specific (what release of product did this appear in) This class is to replace the MethodBasedValueHolder for TransformationMappings Holds on to an AttributeTransformer and uses it to generate the attribute value when triggered. That Transformer may be a MethodBasedAttributeTransformer or a user defined implementation.
- Version:
- $Header: TransformerBasedValueHolder.java 30-aug-2006.11:32:36 gyorke Exp $
- Author:
- mmacivor
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Object
object
Stores the object which owns this attribute.protected AttributeTransformer
transformer
Stores the method to be executed.-
Fields inherited from class org.eclipse.persistence.internal.indirection.DatabaseValueHolder
isCoordinatedWithProperty, isInstantiated, row, session, value
-
Fields inherited from interface org.eclipse.persistence.indirection.ValueHolderInterface
shouldToStringInstantiate
-
-
Constructor Summary
Constructors Constructor Description TransformerBasedValueHolder(AttributeTransformer theTransformer, Object theObject, AbstractRecord theRow, AbstractSession theSession)
Initialize the method-based value holder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
getObject()
Return the receiver.protected AttributeTransformer
getTransformer()
Return the method.protected Object
instantiate()
Instantiate the object by executing the method on the transformer.protected Object
instantiate(Object object, AbstractSession session)
Object
instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)
Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).boolean
isPessimisticLockingValueHolder()
INTERNAL: Answers if this valueholder is a pessimistic locking one.protected void
setObject(Object theObject)
Set the receiver.protected void
setTransformer(AttributeTransformer theTransformer)
Set the transformer.-
Methods inherited from class org.eclipse.persistence.internal.indirection.DatabaseValueHolder
clone, getRow, getSession, getValue, getValue, getWrappedValueHolder, isCoordinatedWithProperty, isEasilyInstantiated, isInstantiated, isNewlyWeavedValueHolder, isSerializedRemoteUnitOfWorkValueHolder, isTransactionalValueHolder, postInstantiate, privilegedSetValue, releaseWrappedValueHolder, resetFields, setInstantiated, setIsCoordinatedWithProperty, setIsNewlyWeavedValueHolder, setRow, setSession, setUninstantiated, setValue, shouldAllowInstantiationDeferral, toString
-
-
-
-
Field Detail
-
transformer
protected transient AttributeTransformer transformer
Stores the method to be executed. The method can take one (the row) or two parameters (the row and session).
-
object
protected transient Object object
Stores the object which owns this attribute.
-
-
Constructor Detail
-
TransformerBasedValueHolder
public TransformerBasedValueHolder(AttributeTransformer theTransformer, Object theObject, AbstractRecord theRow, AbstractSession theSession)
Initialize the method-based value holder.- Parameters:
theTransformer
- The method that returns the object when executed.theObject
- the Object which owns this attribute.theRow
- The row representation of the object.theSession
- The session to the database that stores the object.
-
-
Method Detail
-
getTransformer
protected AttributeTransformer getTransformer()
Return the method.
-
getObject
protected Object getObject()
Return the receiver.
-
instantiate
protected Object instantiate() throws DescriptorException
Instantiate the object by executing the method on the transformer.- Specified by:
instantiate
in classDatabaseValueHolder
- Throws:
DescriptorException
-
instantiate
protected Object instantiate(Object object, AbstractSession session) throws DescriptorException
- Throws:
DescriptorException
-
instantiateForUnitOfWorkValueHolder
public Object instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)
Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).When in transaction and/or for pessimistic locking the UnitOfWorkValueHolder needs to be triggered directly without triggering the wrapped valueholder. However only the wrapped valueholder knows how to trigger the indirection, i.e. it may be a batchValueHolder, and it stores all the info like the row and the query. Note: This method is not thread-safe. It must be used in a synchronized manner
- Specified by:
instantiateForUnitOfWorkValueHolder
in classDatabaseValueHolder
-
isPessimisticLockingValueHolder
public boolean isPessimisticLockingValueHolder()
INTERNAL: Answers if this valueholder is a pessimistic locking one. Such valueholders are special in that they can be triggered multiple times by different UnitsOfWork. Each time a lock query will be issued. Hence even if instantiated it may have to be instantiated again, and once instantiated all fields can not be reset. Note: This method is not thread-safe. It must be used in a synchronized manner- Specified by:
isPessimisticLockingValueHolder
in classDatabaseValueHolder
-
setTransformer
protected void setTransformer(AttributeTransformer theTransformer)
Set the transformer.
-
setObject
protected void setObject(Object theObject)
Set the receiver.
-
-