Top Fields Constructors Methods
org.eclipse.persistence.internal.indirection

public Class TransformerBasedValueHolder<T>

extends DatabaseValueHolder<T>
Class Inheritance
Imports
java.lang.reflect.InvocationTargetException, org.eclipse.persistence.exceptions.DescriptorException, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.transformers.AttributeTransformer

Author
mmacivor
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 $

Field Summary

Modifier and TypeField and Description
protected transient Object
object

Stores the object which owns this attribute.

protected transient AttributeTransformer
transformer

Stores the method to be executed.

Inherited from org.eclipse.persistence.internal.indirection.DatabaseValueHolder:
isCoordinatedWithPropertyisInstantiatedrowsessionvalue

Constructor Summary

AccessConstructor and Description
public
TransformerBasedValueHolder(AttributeTransformer
The method that returns the object when executed.
theTransformer
,
Object
the Object which owns this attribute.
theObject
,
AbstractRecord
The row representation of the object.
theRow
,
AbstractSession
The session to the database that stores the object.
theSession
)

Initialize the method-based value holder.

Method Summary

Modifier and TypeMethod and Description
protected Object
getObject()

Return the receiver.

protected AttributeTransformer
getTransformer()

Return the method.

protected T
instantiate()

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.instantiate.

Instantiate the object by executing the method on the transformer.
protected T
public T
instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder<T> unitOfWorkValueHolder)

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.instantiateForUnitOfWorkValueHolder.

Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).
public boolean
isPessimisticLockingValueHolder()

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.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.

Inherited from org.eclipse.persistence.internal.indirection.DatabaseValueHolder:
clonegetRowgetSessiongetValuegetValuegetWrappedValueHolderisCoordinatedWithPropertyisEasilyInstantiatedisInstantiatedisNewlyWeavedValueHolderisSerializedRemoteUnitOfWorkValueHolderisTransactionalValueHolderpostInstantiateprivilegedSetValuereleaseWrappedValueHolderresetFieldssetInstantiatedsetIsCoordinatedWithPropertysetIsNewlyWeavedValueHoldersetRowsetSessionsetUninstantiatedsetValueshouldAllowInstantiationDeferraltoString

Field Detail

objectback to summary
protected transient Object object

Stores the object which owns this attribute.

transformerback to summary
protected transient AttributeTransformer transformer

Stores the method to be executed. The method can take one (the row) or two parameters (the row and session).

Constructor Detail

TransformerBasedValueHolderback to summary
public TransformerBasedValueHolder(AttributeTransformer theTransformer, Object theObject, AbstractRecord theRow, AbstractSession theSession)

Initialize the method-based value holder.

Parameters
theTransformer:AttributeTransformer

The method that returns the object when executed.

theObject:Object

the Object which owns this attribute.

theRow:AbstractRecord

The row representation of the object.

theSession:AbstractSession

The session to the database that stores the object.

Method Detail

getObjectback to summary
protected Object getObject()

Return the receiver.

getTransformerback to summary
protected AttributeTransformer getTransformer()

Return the method.

instantiateback to summary
protected T instantiate() throws DescriptorException

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.instantiate.

Instantiate the object by executing the method on the transformer.

Annotations
@Override
instantiateback to summary
protected T instantiate(Object object, AbstractSession session) throws DescriptorException
Annotations
@SuppressWarnings:unchecked
instantiateForUnitOfWorkValueHolderback to summary
public T instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder<T> unitOfWorkValueHolder)

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.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

Annotations
@Override
isPessimisticLockingValueHolderback to summary
public boolean isPessimisticLockingValueHolder()

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.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

Annotations
@Override
setObjectback to summary
protected void setObject(Object theObject)

Set the receiver.

setTransformerback to summary
protected void setTransformer(AttributeTransformer theTransformer)

Set the transformer.