Module org.eclipse.persistence.core
Class MethodAttributeAccessor
- java.lang.Object
-
- org.eclipse.persistence.mappings.AttributeAccessor
-
- org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor
-
- All Implemented Interfaces:
Serializable,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 MethodgetMethodprotected StringgetMethodNameprotected MethodsetMethodprotected 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 Class<?>getAttributeClass()Return the return type of the method accessor.ObjectgetAttributeValueFromObject(Object anObject)Gets the value of an instance variable in the object.protected ObjectgetAttributeValueFromObject(Object anObject, Object[] parameters)Gets the value of an instance variable in the object.MethodgetGetMethod()Return the accessor method for the attribute accessor.StringgetGetMethodName()Return the name of the accessor method for the attribute accessor.Class<?>getGetMethodReturnType()INTERNAL: Return the GetMethod return type for this MethodAttributeAccessor.protected MethodgetSetMethod()Return the set method for the attribute accessor.StringgetSetMethodName()Return the name of the set method for the attribute accessor.Class<?>getSetMethodParameterType()protected Class<?>getSetMethodParameterType(int index)protected Class<?>[]getSetMethodParameterTypes()voidinitializeAttributes(Class<?> theJavaClass)Set get and set method after creating these methods by using get and set method namesprotected voidinitializeAttributes(Class<?> theJavaClass, 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(Object domainObject, Object attributeValue)Sets the value of the instance variable in the object to the value.protected voidsetAttributeValueInObject(Object domainObject, Object attributeValue, Object[] parameters)Sets the value of the instance variable in the object to the value.protected voidsetGetMethod(Method getMethod)Set the accessor method for the attribute accessor.voidsetGetMethodName(String getMethodName)Set the name of the accessor method for the attribute accessor.protected voidsetSetMethod(Method setMethod)Set the set method for the attribute accessor.voidsetSetMethodName(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 Class<?> getAttributeClass()
Return the return type of the method accessor.- Specified by:
getAttributeClassin interfaceCoreAttributeAccessor- Overrides:
getAttributeClassin classAttributeAccessor
-
getAttributeValueFromObject
public Object getAttributeValueFromObject(Object anObject) throws DescriptorException
Gets the value of an instance variable in the object.- Specified by:
getAttributeValueFromObjectin interfaceCoreAttributeAccessor- Specified by:
getAttributeValueFromObjectin classAttributeAccessor- Throws:
DescriptorException
-
getAttributeValueFromObject
protected Object getAttributeValueFromObject(Object anObject, Object[] parameters) throws DescriptorException
Gets the value of an instance variable in the object.- Throws:
DescriptorException
-
getGetMethod
public Method getGetMethod()
Return the accessor method for the attribute accessor. 266912: For Metamodel API - change visibility from protected
-
getGetMethodName
public String getGetMethodName()
Return the name of the accessor method for the attribute accessor.
-
getGetMethodReturnType
public 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.- Throws:
DescriptorException
-
getSetMethod
protected Method getSetMethod()
Return the set method for the attribute accessor.
-
getSetMethodName
public String getSetMethodName()
Return the name of the set method for the attribute accessor.
-
getSetMethodParameterType
public Class<?> getSetMethodParameterType()
-
getSetMethodParameterType
protected Class<?> getSetMethodParameterType(int index)
-
getSetMethodParameterTypes
protected Class<?>[] getSetMethodParameterTypes()
-
initializeAttributes
public void initializeAttributes(Class<?> theJavaClass) throws DescriptorException
Set 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(Class<?> theJavaClass, 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:
isInitializedin classAttributeAccessor
-
isMethodAttributeAccessor
public boolean isMethodAttributeAccessor()
- Specified by:
isMethodAttributeAccessorin interfaceCoreAttributeAccessor- Overrides:
isMethodAttributeAccessorin classAttributeAccessor
-
setAttributeValueInObject
public void setAttributeValueInObject(Object domainObject, Object attributeValue) throws DescriptorException
Sets 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(Object domainObject, Object attributeValue, Object[] parameters) throws DescriptorException
Sets the value of the instance variable in the object to the value.- Throws:
DescriptorException
-
setGetMethod
protected void setGetMethod(Method getMethod)
Set the accessor method for the attribute accessor.
-
setGetMethodName
public void setGetMethodName(String getMethodName)
Set the name of the accessor method for the attribute accessor.
-
setSetMethod
protected void setSetMethod(Method setMethod)
Set the set method for the attribute accessor.
-
setSetMethodName
public void setSetMethodName(String setMethodName)
Set the name of the set method for the attribute accessor.
-
-