Class MethodAttributeAccessor
- java.lang.Object
-
- org.eclipse.persistence.mappings.AttributeAccessor
-
- org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,CoreAttributeAccessor
- Direct Known Subclasses:
VirtualAttributeAccessor
public class MethodAttributeAccessor extends AttributeAccessor
Purpose: A wrapper class for handling cases when the domain object attributes are to be accessed thru the accessor methods. This could happen if the variables are not defined public in the domain object.
- Since:
- TOPLink/Java 1.0
- Author:
- Sati
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.reflect.MethodgetMethodprotected java.lang.StringgetMethodNameprotected java.lang.reflect.MethodsetMethodprotected java.lang.StringsetMethodName-
Fields inherited from class org.eclipse.persistence.mappings.AttributeAccessor
attributeName, isReadOnly, isWriteOnly
-
-
Constructor Summary
Constructors Constructor Description MethodAttributeAccessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ClassgetAttributeClass()Return the return type of the method accessor.java.lang.ObjectgetAttributeValueFromObject(java.lang.Object anObject)Gets the value of an instance variable in the object.protected java.lang.ObjectgetAttributeValueFromObject(java.lang.Object anObject, java.lang.Object[] parameters)Gets the value of an instance variable in the object.java.lang.reflect.MethodgetGetMethod()Return the accessor method for the attribute accessor.java.lang.StringgetGetMethodName()Return the name of the accessor method for the attribute accessor.java.lang.ClassgetGetMethodReturnType()INTERNAL: Return the GetMethod return type for this MethodAttributeAccessor.protected java.lang.reflect.MethodgetSetMethod()Return the set method for the attribute accessor.java.lang.StringgetSetMethodName()Return the name of the set method for the attribute accessor.java.lang.ClassgetSetMethodParameterType()protected java.lang.ClassgetSetMethodParameterType(int index)protected java.lang.Class[]getSetMethodParameterTypes()voidinitializeAttributes(java.lang.Class theJavaClass)Set get and set method after creating these methods by using get and set method namesprotected voidinitializeAttributes(java.lang.Class theJavaClass, java.lang.Class[] getParameterTypes)Set get and set method after creating these methods by using get and set method namesbooleanisInitialized()Returns true if this attribute accessor has been initialized and now stores a reference to the class's attribute.booleanisMethodAttributeAccessor()voidsetAttributeValueInObject(java.lang.Object domainObject, java.lang.Object attributeValue)Sets the value of the instance variable in the object to the value.protected voidsetAttributeValueInObject(java.lang.Object domainObject, java.lang.Object attributeValue, java.lang.Object[] parameters)Sets the value of the instance variable in the object to the value.protected voidsetGetMethod(java.lang.reflect.Method getMethod)Set the accessor method for the attribute accessor.voidsetGetMethodName(java.lang.String getMethodName)Set the name of the accessor method for the attribute accessor.protected voidsetSetMethod(java.lang.reflect.Method setMethod)Set the set method for the attribute accessor.voidsetSetMethodName(java.lang.String setMethodName)Set the name of the set method for the attribute accessor.-
Methods inherited from class org.eclipse.persistence.mappings.AttributeAccessor
clone, getAttributeName, isInstanceVariableAttributeAccessor, isMapValueAttributeAccessor, isReadOnly, isValuesAccessor, isVirtualAttributeAccessor, isWriteOnly, setAttributeName, setIsReadOnly, setIsWriteOnly
-
-
-
-
Method Detail
-
getAttributeClass
public java.lang.Class getAttributeClass()
Return the return type of the method accessor.- Specified by:
getAttributeClassin interfaceCoreAttributeAccessor- Overrides:
getAttributeClassin classAttributeAccessor
-
getAttributeValueFromObject
public java.lang.Object getAttributeValueFromObject(java.lang.Object anObject) throws DescriptorExceptionGets the value of an instance variable in the object.- Specified by:
getAttributeValueFromObjectin interfaceCoreAttributeAccessor- Specified by:
getAttributeValueFromObjectin classAttributeAccessor- Throws:
DescriptorException
-
getAttributeValueFromObject
protected java.lang.Object getAttributeValueFromObject(java.lang.Object anObject, java.lang.Object[] parameters) throws DescriptorExceptionGets the value of an instance variable in the object.- Throws:
DescriptorException
-
getGetMethod
public java.lang.reflect.Method getGetMethod()
Return the accessor method for the attribute accessor. 266912: For Metamodel API - change visibility from protected
-
getGetMethodName
public java.lang.String getGetMethodName()
Return the name of the accessor method for the attribute accessor.
-
getGetMethodReturnType
public java.lang.Class getGetMethodReturnType() throws DescriptorExceptionINTERNAL: Return the GetMethod return type for this MethodAttributeAccessor. A special check is made to determine if a missing method is a result of failed weaving.- Returns:
- Throws:
DescriptorException
-
getSetMethod
protected java.lang.reflect.Method getSetMethod()
Return the set method for the attribute accessor.
-
getSetMethodName
public java.lang.String getSetMethodName()
Return the name of the set method for the attribute accessor.
-
getSetMethodParameterType
public java.lang.Class getSetMethodParameterType()
-
getSetMethodParameterType
protected java.lang.Class getSetMethodParameterType(int index)
-
getSetMethodParameterTypes
protected java.lang.Class[] getSetMethodParameterTypes()
-
initializeAttributes
public void initializeAttributes(java.lang.Class theJavaClass) throws DescriptorExceptionSet get and set method after creating these methods by using get and set method names- Specified by:
initializeAttributesin interfaceCoreAttributeAccessor- Overrides:
initializeAttributesin classAttributeAccessor- Throws:
DescriptorException
-
initializeAttributes
protected void initializeAttributes(java.lang.Class theJavaClass, java.lang.Class[] getParameterTypes) throws DescriptorExceptionSet get and set method after creating these methods by using get and set method names- Throws:
DescriptorException
-
isInitialized
public boolean isInitialized()
Returns true if this attribute accessor has been initialized and now stores a reference to the class's attribute. An attribute accessor can become uninitialized on serialization.- Overrides:
isInitializedin classAttributeAccessor
-
isMethodAttributeAccessor
public boolean isMethodAttributeAccessor()
- Specified by:
isMethodAttributeAccessorin interfaceCoreAttributeAccessor- Overrides:
isMethodAttributeAccessorin classAttributeAccessor
-
setAttributeValueInObject
public void setAttributeValueInObject(java.lang.Object domainObject, java.lang.Object attributeValue) throws DescriptorExceptionSets the value of the instance variable in the object to the value.- Specified by:
setAttributeValueInObjectin interfaceCoreAttributeAccessor- Specified by:
setAttributeValueInObjectin classAttributeAccessor- Throws:
DescriptorException
-
setAttributeValueInObject
protected void setAttributeValueInObject(java.lang.Object domainObject, java.lang.Object attributeValue, java.lang.Object[] parameters) throws DescriptorExceptionSets the value of the instance variable in the object to the value.- Throws:
DescriptorException
-
setGetMethod
protected void setGetMethod(java.lang.reflect.Method getMethod)
Set the accessor method for the attribute accessor.
-
setGetMethodName
public void setGetMethodName(java.lang.String getMethodName)
Set the name of the accessor method for the attribute accessor.
-
setSetMethod
protected void setSetMethod(java.lang.reflect.Method setMethod)
Set the set method for the attribute accessor.
-
setSetMethodName
public void setSetMethodName(java.lang.String setMethodName)
Set the name of the set method for the attribute accessor.
-
-