Class WeavedObjectBasicIndirectionPolicy

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class WeavedObjectBasicIndirectionPolicy
    extends BasicIndirectionPolicy
    A WeavedObjectBasicIndirectionPolicy is used by OneToOne mappings that are LAZY through weaving and which use Property(method) access. It extends BasicIndirection by providing the capability of calling the set method that was initially mapped in addition to the set method for the weaved valueholder in order to coordinate the value of the underlying property with the value stored in the valueholder
    Author:
    Tom Ware
    See Also:
    Serialized Form
    • Field Detail

      • setMethodName

        protected String setMethodName
        Name of the initial set method.
      • setMethod

        protected transient Method setMethod
        Lazily initialized set method based on the set method name.
      • getMethodName

        protected String getMethodName
        Name of the initial get method.
      • hasUsedMethodAccess

        protected boolean hasUsedMethodAccess
        indicates whether the mapping has originally used method access
      • actualTypeClassName

        protected String actualTypeClassName
        Stores the actual type of the mapping if different from the reference type. Used for set method invocation
    • Constructor Detail

      • WeavedObjectBasicIndirectionPolicy

        public WeavedObjectBasicIndirectionPolicy​(String getMethodName,
                                                  String setMethodName,
                                                  String actualTypeClassName,
                                                  boolean hasUsedMethodAccess)
    • Method Detail

      • getActualTypeClassName

        public String getActualTypeClassName()
      • getRealAttributeValueFromObject

        public Object getRealAttributeValueFromObject​(Object object,
                                                      Object attribute)
        Return the "real" attribute value, as opposed to any wrapper. This will trigger the wrapper to instantiate the value. In a weaved policy, this will also call the initial setter method to coordinate the values of the valueholder with the underlying data.
        Overrides:
        getRealAttributeValueFromObject in class BasicIndirectionPolicy
      • getSetMethod

        protected Method getSetMethod()
        This method will lazily initialize the set method Lazy initialization occurs to that we are not required to have a handle on the actual class that we are using until runtime. This helps to satisfy the weaving requirement that demands that we avoid loading domain classes into the main class loader until after weaving occurs.
      • updateValueInObject

        public void updateValueInObject​(Object object,
                                        Object value,
                                        Object attributeValue)
        Coordinate the valueholder for this mapping with the underlying property by calling the initial setter method.
      • setRealAttributeValueInObject

        public void setRealAttributeValueInObject​(Object target,
                                                  Object attributeValue)
        Set the value of the appropriate attribute of target to attributeValue. In this case, place the value inside the target's ValueHolder. Change tracking will be turned off when this method is called
        Overrides:
        setRealAttributeValueInObject in class BasicIndirectionPolicy
      • setRealAttributeValueInObject

        public void setRealAttributeValueInObject​(Object target,
                                                  Object attributeValue,
                                                  boolean trackChanges)
        Set the value of the appropriate attribute of target to attributeValue. In this case, place the value inside the target's ValueHolder. if trackChanges is true, set the value in the object as if the user was setting it. Allow change tracking to pick up the change.
        Overrides:
        setRealAttributeValueInObject in class IndirectionPolicy
      • getGetMethodName

        public String getGetMethodName()
      • getSetMethodName

        public String getSetMethodName()
      • hasUsedMethodAccess

        public boolean hasUsedMethodAccess()