Module org.eclipse.persistence.core
Class TransformerBasedValueHolder<T>
java.lang.Object
org.eclipse.persistence.internal.indirection.DatabaseValueHolder<T>
org.eclipse.persistence.internal.indirection.TransformerBasedValueHolder<T>
- All Implemented Interfaces:
Serializable
,Cloneable
,ValueHolderInterface<T>
,WeavedAttributeValueHolderInterface<T>
- 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 $
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Object
Stores the object which owns this attribute.protected AttributeTransformer
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
ConstructorDescriptionTransformerBasedValueHolder
(AttributeTransformer theTransformer, Object theObject, AbstractRecord theRow, AbstractSession theSession) Initialize the method-based value holder. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
Return the receiver.protected AttributeTransformer
Return the method.protected T
Instantiate the object by executing the method on the transformer.protected T
instantiate
(Object object, AbstractSession session) instantiateForUnitOfWorkValueHolder
(UnitOfWorkValueHolder<T> unitOfWorkValueHolder) Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).boolean
INTERNAL: Answers if this valueholder is a pessimistic locking one.protected void
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 Details
-
transformer
Stores the method to be executed. The method can take one (the row) or two parameters (the row and session). -
object
Stores the object which owns this attribute.
-
-
Constructor Details
-
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 Details
-
getTransformer
Return the method. -
getObject
Return the receiver. -
instantiate
Instantiate the object by executing the method on the transformer.- Specified by:
instantiate
in classDatabaseValueHolder<T>
- Throws:
DescriptorException
-
instantiate
- Throws:
DescriptorException
-
instantiateForUnitOfWorkValueHolder
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<T>
-
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<T>
-
setTransformer
Set the transformer. -
setObject
Set the receiver.
-