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.Method
getMethod
protected java.lang.String
getMethodName
protected java.lang.reflect.Method
setMethod
protected java.lang.String
setMethodName
-
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.Class
getAttributeClass()
Return the return type of the method accessor.java.lang.Object
getAttributeValueFromObject(java.lang.Object anObject)
Gets the value of an instance variable in the object.protected java.lang.Object
getAttributeValueFromObject(java.lang.Object anObject, java.lang.Object[] parameters)
Gets the value of an instance variable in the object.java.lang.reflect.Method
getGetMethod()
Return the accessor method for the attribute accessor.java.lang.String
getGetMethodName()
Return the name of the accessor method for the attribute accessor.java.lang.Class
getGetMethodReturnType()
INTERNAL: Return the GetMethod return type for this MethodAttributeAccessor.protected java.lang.reflect.Method
getSetMethod()
Return the set method for the attribute accessor.java.lang.String
getSetMethodName()
Return the name of the set method for the attribute accessor.java.lang.Class
getSetMethodParameterType()
protected java.lang.Class
getSetMethodParameterType(int index)
protected java.lang.Class[]
getSetMethodParameterTypes()
void
initializeAttributes(java.lang.Class theJavaClass)
Set get and set method after creating these methods by using get and set method namesprotected void
initializeAttributes(java.lang.Class theJavaClass, java.lang.Class[] getParameterTypes)
Set get and set method after creating these methods by using get and set method namesboolean
isInitialized()
Returns true if this attribute accessor has been initialized and now stores a reference to the class's attribute.boolean
isMethodAttributeAccessor()
void
setAttributeValueInObject(java.lang.Object domainObject, java.lang.Object attributeValue)
Sets the value of the instance variable in the object to the value.protected void
setAttributeValueInObject(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 void
setGetMethod(java.lang.reflect.Method getMethod)
Set the accessor method for the attribute accessor.void
setGetMethodName(java.lang.String getMethodName)
Set the name of the accessor method for the attribute accessor.protected void
setSetMethod(java.lang.reflect.Method setMethod)
Set the set method for the attribute accessor.void
setSetMethodName(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:
getAttributeClass
in interfaceCoreAttributeAccessor
- Overrides:
getAttributeClass
in classAttributeAccessor
-
getAttributeValueFromObject
public java.lang.Object getAttributeValueFromObject(java.lang.Object anObject) throws DescriptorException
Gets the value of an instance variable in the object.- Specified by:
getAttributeValueFromObject
in interfaceCoreAttributeAccessor
- Specified by:
getAttributeValueFromObject
in classAttributeAccessor
- Throws:
DescriptorException
-
getAttributeValueFromObject
protected java.lang.Object getAttributeValueFromObject(java.lang.Object anObject, java.lang.Object[] parameters) throws DescriptorException
Gets 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 DescriptorException
INTERNAL: 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 DescriptorException
Set get and set method after creating these methods by using get and set method names- Specified by:
initializeAttributes
in interfaceCoreAttributeAccessor
- Overrides:
initializeAttributes
in classAttributeAccessor
- Throws:
DescriptorException
-
initializeAttributes
protected void initializeAttributes(java.lang.Class theJavaClass, java.lang.Class[] getParameterTypes) throws DescriptorException
Set 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:
isInitialized
in classAttributeAccessor
-
isMethodAttributeAccessor
public boolean isMethodAttributeAccessor()
- Specified by:
isMethodAttributeAccessor
in interfaceCoreAttributeAccessor
- Overrides:
isMethodAttributeAccessor
in classAttributeAccessor
-
setAttributeValueInObject
public void setAttributeValueInObject(java.lang.Object domainObject, java.lang.Object attributeValue) throws DescriptorException
Sets the value of the instance variable in the object to the value.- Specified by:
setAttributeValueInObject
in interfaceCoreAttributeAccessor
- Specified by:
setAttributeValueInObject
in classAttributeAccessor
- Throws:
DescriptorException
-
setAttributeValueInObject
protected void setAttributeValueInObject(java.lang.Object domainObject, java.lang.Object attributeValue, java.lang.Object[] parameters) throws DescriptorException
Sets 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.
-
-