Class WeavedObjectBasicIndirectionPolicy
- java.lang.Object
-
- org.eclipse.persistence.internal.indirection.IndirectionPolicy
-
- org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy
-
- org.eclipse.persistence.internal.indirection.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 Summary
Fields Modifier and Type Field Description protected String
actualTypeClassName
Stores the actual type of the mapping if different from the reference type.protected String
getMethodName
Name of the initial get method.protected boolean
hasUsedMethodAccess
indicates whether the mapping has originally used method accessprotected Method
setMethod
Lazily initialized set method based on the set method name.protected String
setMethodName
Name of the initial set method.-
Fields inherited from class org.eclipse.persistence.internal.indirection.IndirectionPolicy
mapping
-
-
Constructor Summary
Constructors Constructor Description WeavedObjectBasicIndirectionPolicy(String getMethodName, String setMethodName, String actualTypeClassName, boolean hasUsedMethodAccess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getActualTypeClassName()
String
getGetMethodName()
Object
getRealAttributeValueFromObject(Object object, Object attribute)
Return the "real" attribute value, as opposed to any wrapper.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.String
getSetMethodName()
boolean
hasUsedMethodAccess()
boolean
isWeavedObjectBasicIndirectionPolicy()
INTERNAL:void
setRealAttributeValueInObject(Object target, Object attributeValue)
Set the value of the appropriate attribute of target to attributeValue.void
setRealAttributeValueInObject(Object target, Object attributeValue, boolean trackChanges)
Set the value of the appropriate attribute of target to attributeValue.void
updateValueInObject(Object object, Object value, Object attributeValue)
Coordinate the valueholder for this mapping with the underlying property by calling the initial setter method.-
Methods inherited from class org.eclipse.persistence.internal.indirection.BasicIndirectionPolicy
backupCloneAttribute, buildIndirectObject, cloneAttribute, extractPrimaryKeyForReferenceObject, extractReferenceRow, fixObjectReferences, getOriginalIndirectionObject, getOriginalIndirectionObjectForMerge, getOriginalValueHolder, getValueFromRemoteValueHolder, isAttributeValueFullyBuilt, iterateOnAttributeValue, mergeRemoteValueHolder, nullValueFromRow, objectIsEasilyInstantiated, objectIsInstantiated, reset, setSourceObject, typeIsValid, validateAttributeOfInstantiatedObject, validateDeclaredAttributeType, validateGetMethodReturnType, validateSetMethodParameterType, valueFromBatchQuery, valueFromMethod, valueFromQuery, valueFromQuery, valueFromRow
-
Methods inherited from class org.eclipse.persistence.internal.indirection.IndirectionPolicy
buildCascadeQuery, clone, getCollectionMapping, getForeignReferenceMapping, getMapping, getOneToOneMapping, getTransformationMapping, initialize, instantiateObject, mergeClientIntoServerValueHolder, objectIsInstantiatedOrChanged, setMapping, setUseLazyInstantiation, shouldUseLazyInstantiation, usesIndirection, usesTransparentIndirection, validateContainerPolicy, validateDeclaredAttributeTypeForCollection, validateGetMethodReturnTypeForCollection, validateSetMethodParameterTypeForCollection
-
-
-
-
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
-
-
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 classBasicIndirectionPolicy
-
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 classBasicIndirectionPolicy
-
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 classIndirectionPolicy
-
getGetMethodName
public String getGetMethodName()
-
getSetMethodName
public String getSetMethodName()
-
hasUsedMethodAccess
public boolean hasUsedMethodAccess()
-
isWeavedObjectBasicIndirectionPolicy
public boolean isWeavedObjectBasicIndirectionPolicy()
Description copied from class:IndirectionPolicy
INTERNAL:- Overrides:
isWeavedObjectBasicIndirectionPolicy
in classIndirectionPolicy
-
-