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:
java.io.Serializable,java.lang.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 java.lang.StringactualTypeClassNameStores the actual type of the mapping if different from the reference type.protected java.lang.StringgetMethodNameName of the initial get method.protected booleanhasUsedMethodAccessindicates whether the mapping has originally used method accessprotected java.lang.reflect.MethodsetMethodLazily initialized set method based on the set method name.protected java.lang.StringsetMethodNameName of the initial set method.-
Fields inherited from class org.eclipse.persistence.internal.indirection.IndirectionPolicy
mapping
-
-
Constructor Summary
Constructors Constructor Description WeavedObjectBasicIndirectionPolicy(java.lang.String getMethodName, java.lang.String setMethodName, java.lang.String actualTypeClassName, boolean hasUsedMethodAccess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetActualTypeClassName()java.lang.StringgetGetMethodName()java.lang.ObjectgetRealAttributeValueFromObject(java.lang.Object object, java.lang.Object attribute)Return the "real" attribute value, as opposed to any wrapper.protected java.lang.reflect.MethodgetSetMethod()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.java.lang.StringgetSetMethodName()booleanhasUsedMethodAccess()booleanisWeavedObjectBasicIndirectionPolicy()INTERNAL:voidsetRealAttributeValueInObject(java.lang.Object target, java.lang.Object attributeValue)Set the value of the appropriate attribute of target to attributeValue.voidsetRealAttributeValueInObject(java.lang.Object target, java.lang.Object attributeValue, boolean trackChanges)Set the value of the appropriate attribute of target to attributeValue.voidupdateValueInObject(java.lang.Object object, java.lang.Object value, java.lang.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 java.lang.String setMethodName
Name of the initial set method.
-
setMethod
protected transient java.lang.reflect.Method setMethod
Lazily initialized set method based on the set method name.
-
getMethodName
protected java.lang.String getMethodName
Name of the initial get method.
-
hasUsedMethodAccess
protected boolean hasUsedMethodAccess
indicates whether the mapping has originally used method access
-
actualTypeClassName
protected java.lang.String actualTypeClassName
Stores the actual type of the mapping if different from the reference type. Used for set method invocation
-
-
Method Detail
-
getActualTypeClassName
public java.lang.String getActualTypeClassName()
-
getRealAttributeValueFromObject
public java.lang.Object getRealAttributeValueFromObject(java.lang.Object object, java.lang.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:
getRealAttributeValueFromObjectin classBasicIndirectionPolicy
-
getSetMethod
protected java.lang.reflect.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(java.lang.Object object, java.lang.Object value, java.lang.Object attributeValue)Coordinate the valueholder for this mapping with the underlying property by calling the initial setter method.
-
setRealAttributeValueInObject
public void setRealAttributeValueInObject(java.lang.Object target, java.lang.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:
setRealAttributeValueInObjectin classBasicIndirectionPolicy
-
setRealAttributeValueInObject
public void setRealAttributeValueInObject(java.lang.Object target, java.lang.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:
setRealAttributeValueInObjectin classIndirectionPolicy
-
getGetMethodName
public java.lang.String getGetMethodName()
-
getSetMethodName
public java.lang.String getSetMethodName()
-
hasUsedMethodAccess
public boolean hasUsedMethodAccess()
-
isWeavedObjectBasicIndirectionPolicy
public boolean isWeavedObjectBasicIndirectionPolicy()
Description copied from class:IndirectionPolicyINTERNAL:- Overrides:
isWeavedObjectBasicIndirectionPolicyin classIndirectionPolicy
-
-