Class 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 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

      • getObject

        protected Object getObject()
        Return the receiver.
      • 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 class DatabaseValueHolder
      • 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 class DatabaseValueHolder
      • setTransformer

        protected void setTransformer​(AttributeTransformer theTransformer)
        Set the transformer.
      • setObject

        protected void setObject​(Object theObject)
        Set the receiver.