Package org.simpleframework.xml.core
Interface Contact
-
- All Superinterfaces:
Type
- All Known Implementing Classes:
AttributeParameter.Contact
,ElementArrayParameter.Contact
,ElementListParameter.Contact
,ElementListUnionParameter.Contact
,ElementMapParameter.Contact
,ElementMapUnionParameter.Contact
,ElementParameter.Contact
,ElementUnionParameter.Contact
,FieldContact
,MethodContact
,ParameterContact
,TextParameter.Contact
interface Contact extends Type
TheContact
interface is used to provide a point of contact with an object. Typically this will be used to get and set to an from a field or a pair of matching bean methods. Each contact must be labeled with an annotation.- See Also:
Label
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
get(java.lang.Object source)
This is used to get the value from the specified object using the point of contact.java.lang.annotation.Annotation
getAnnotation()
This is the annotation associated with the point of contact.java.lang.Class
getDeclaringClass()
This is the class that declares the contact.java.lang.Class
getDependent()
This provides the dependent class for the contact.java.lang.Class[]
getDependents()
This provides the dependent classes for the contact.java.lang.String
getName()
This represents the name of the object contact.boolean
isReadOnly()
This is used to determine if the annotated contact is for a read only variable.void
set(java.lang.Object source, java.lang.Object value)
This is used to set the value on the specified object through this contact.java.lang.String
toString()
This is used to describe the contact as it exists within the owning class.-
Methods inherited from interface org.simpleframework.xml.strategy.Type
getAnnotation, getType
-
-
-
-
Method Detail
-
getName
java.lang.String getName()
This represents the name of the object contact. If the contact is a field then the name of the field is provided. If however the contact is a method then the Java Bean name of the method is provided, which will be the decapitalized name of the method without the get, set, or is prefix to the method.- Returns:
- this returns the name of the contact represented
-
getDependent
java.lang.Class getDependent()
This provides the dependent class for the contact. This will typically represent a generic type for the actual type. For contacts that use aCollection
type this will be the generic type parameter for that collection.- Returns:
- this returns the dependent type for the contact
-
getDependents
java.lang.Class[] getDependents()
This provides the dependent classes for the contact. This will typically represent a generic types for the actual type. For contacts that use aMap
type this will be the generic type parameter for that map type declaration.- Returns:
- this returns the dependent types for the contact
-
getDeclaringClass
java.lang.Class getDeclaringClass()
This is the class that declares the contact. The declaring class is where the field or method has been defined. This will typically be a class rather than an interface.- Returns:
- this returns the class the contact is declared within
-
getAnnotation
java.lang.annotation.Annotation getAnnotation()
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.- Returns:
- this provides the annotation associated with this
-
set
void set(java.lang.Object source, java.lang.Object value) throws java.lang.Exception
This is used to set the value on the specified object through this contact. Depending on the type of contact this will set the value given, typically this will be done by invoking a method or setting the value on the object field.- Parameters:
source
- this is the object to set the value onvalue
- this is the value to be set through the contact- Throws:
java.lang.Exception
-
get
java.lang.Object get(java.lang.Object source) throws java.lang.Exception
This is used to get the value from the specified object using the point of contact. Typically the value is retrieved from the specified object by invoking a get method of by acquiring the value from a field within the specified object.- Parameters:
source
- this is the object to acquire the value from- Returns:
- this is the value acquired from the point of contact
- Throws:
java.lang.Exception
-
isReadOnly
boolean isReadOnly()
This is used to determine if the annotated contact is for a read only variable. A read only variable is a field that can be set from within the constructor such as a blank final variable. It can also be a method with no set counterpart.- Returns:
- this returns true if the contact is a constant one
-
toString
java.lang.String toString()
This is used to describe the contact 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 contact.
-
-