Package org.simpleframework.xml.core
Class GetPart
- java.lang.Object
-
- org.simpleframework.xml.core.GetPart
-
- All Implemented Interfaces:
MethodPart
class GetPart extends java.lang.Object implements MethodPart
TheGetPartobject represents the getter method for a Java Bean property. This composes the get part of the method contact for an object. The get part contains the method that is used to get the value in an object and the annotation that tells the serialization process how to serialize the value.- See Also:
MethodContact
-
-
Field Summary
Fields Modifier and Type Field Description private Cache<java.lang.annotation.Annotation>cacheThis cache contains the annotations present on the method.private java.lang.annotation.AnnotationlabelThis is the annotation for the get method provided.private java.lang.annotation.Annotation[]listThis is the list of annotations associated with the method.private java.lang.reflect.MethodmethodThis method is used to get the value during serialization.private java.lang.StringnameThis is the Java Bean name representation of the method.private MethodTypetypeThis represents the method type for the get part method.
-
Constructor Summary
Constructors Constructor Description GetPart(MethodName method, java.lang.annotation.Annotation label, java.lang.annotation.Annotation[] list)Constructor for theGetPartobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.annotation.AnnotationgetAnnotation()This is used to acquire the annotation that was used to label the method this represents.<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> type)This is the annotation associated with the point of contact.java.lang.ClassgetDeclaringClass()This is the class that declares the contact.java.lang.ClassgetDependent()This is used to acquire the dependent class for the method part.java.lang.Class[]getDependents()This is used to acquire the dependent classes for the method part.java.lang.reflect.MethodgetMethod()This is used to acquire the method that can be used to invoke the Java Bean method on the object.MethodTypegetMethodType()This is the method type for the method part.java.lang.StringgetName()This provides the name of the method part as acquired from the method name.java.lang.ClassgetType()This is used to acquire the type for this method part.java.lang.StringtoString()This is used to describe the method as it exists within the owning class.
-
-
-
Field Detail
-
cache
private final Cache<java.lang.annotation.Annotation> cache
This cache contains the annotations present on the method.
-
list
private final java.lang.annotation.Annotation[] list
This is the list of annotations associated with the method.
-
label
private final java.lang.annotation.Annotation label
This is the annotation for the get method provided.
-
type
private final MethodType type
This represents the method type for the get part method.
-
method
private final java.lang.reflect.Method method
This method is used to get the value during serialization.
-
name
private final java.lang.String name
This is the Java Bean name representation of the method.
-
-
Constructor Detail
-
GetPart
public GetPart(MethodName method, java.lang.annotation.Annotation label, java.lang.annotation.Annotation[] list)
Constructor for theGetPartobject. This is used to create a method part that will provide a means for the serialization process to set a value to a object.- Parameters:
method- the method that is used to get the valuelabel- this describes how to serialize the valuelist- this is the list of annotations on the method
-
-
Method Detail
-
getName
public java.lang.String getName()
This provides the name of the method part as acquired from the method name. The name represents the Java Bean property name of the method and is used to pair getter and setter methods.- Specified by:
getNamein interfaceMethodPart- Returns:
- this returns the Java Bean name of the method part
-
getType
public java.lang.Class getType()
This is used to acquire the type for this method part. This is used by the serializer to determine the schema class that is used to match the XML elements to the object details.- Specified by:
getTypein interfaceMethodPart- Returns:
- this returns the schema class for this method
-
getDependent
public java.lang.Class getDependent()
This is used to acquire the dependent class for the method part. The dependent type is the type that represents the generic type of the type. This is used when collections are annotated as it allows a default entry class to be taken from the generic information provided.- Specified by:
getDependentin interfaceMethodPart- Returns:
- this returns the generic dependent for the type
-
getDependents
public java.lang.Class[] getDependents()
This is used to acquire the dependent classes for the method part. The dependent types are the types that represent the generic types of the type. This is used when collections are annotated as it allows a default entry class to be taken from the generic information provided.- Specified by:
getDependentsin interfaceMethodPart- Returns:
- this returns the generic dependent for the type
-
getDeclaringClass
public java.lang.Class getDeclaringClass()
This is the class that declares the contact. The declaring class is where the method represented has been defined. This will typically be a class rather than an interface.- Specified by:
getDeclaringClassin interfaceMethodPart- Returns:
- this returns the class the part is declared within
-
getAnnotation
public java.lang.annotation.Annotation getAnnotation()
This is used to acquire the annotation that was used to label the method this represents. This acts as a means to match the set method with the get method using an annotation comparison.- Specified by:
getAnnotationin interfaceMethodPart- Returns:
- this returns the annotation used to mark the method
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> type)
This is the annotation associated with the point of contact. This will be an XML annotation that describes how the contact should be serialized and deserialized from the object.- Specified by:
getAnnotationin interfaceMethodPart- Parameters:
type- this is the type of the annotation to acquire- Returns:
- this provides the annotation associated with this
-
getMethodType
public MethodType getMethodType()
This is the method type for the method part. This is used in the scanning process to determine which type of method a instance represents, this allows set and get methods to be paired.- Specified by:
getMethodTypein interfaceMethodPart- Returns:
- the method type that this part represents
-
getMethod
public java.lang.reflect.Method getMethod()
This is used to acquire the method that can be used to invoke the Java Bean method on the object. If the method represented by this is inaccessible then this will set it as accessible.- Specified by:
getMethodin interfaceMethodPart- Returns:
- returns the method used to interface with the object
-
toString
public java.lang.String toString()
This is used to describe the method as it exists within the owning class. This is used to provide error messages that can be used to debug issues that occur when processing a method. This returns the method as a generic string representation.- Specified by:
toStringin interfaceMethodPart- Overrides:
toStringin classjava.lang.Object- Returns:
- this returns a string representation of the method
-
-