Package org.simpleframework.xml.core
Class Introspector
java.lang.Object
org.simpleframework.xml.core.Introspector
The
Introspector
object is used to determine the details
to use for an annotated field or method using both the field an
annotation details. This allows defaults to be picked up from the
method or field type if that have not been explicitly overridden
in the annotation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Contact
This is the field or method contact that has been annotated.private final Format
This is the format used to style the paths created.private final Label
This is the label used to expose the annotation details.private final Annotation
This is the actual annotation from the specified contact. -
Constructor Summary
ConstructorsConstructorDescriptionIntrospector
(Contact contact, Label label, Format format) Constructor for theIntrospector
object. -
Method Summary
Modifier and TypeMethodDescriptionThis is used to acquire theContact
for this.private String
This is used to acquire the name for an element by firstly checking for an override in the annotation.This returns the dependent type for the annotation.getEntry()
This method is used to get the entry name of a label using the type of the label.This method is used to return an XPath expression that is used to represent the position of a label.getName()
This is used to determine the name of the XML element that the annotated field or method represents.private String
This is used to acquire the name of the specified type using theRoot
annotation for the class.getPath()
This is used to acquire the path of the element or attribute that is used by the class schema.private String
This will acquire the name of theRoot
annotation for the specified class.private String
This will acquire the name of theRoot
annotation for the specified class.boolean
This method is used to determine if a root annotation value is an empty value.toString()
This method is used to construct a string that describes the signature of an XML annotated field or method.
-
Field Details
-
marker
This is the actual annotation from the specified contact. -
contact
This is the field or method contact that has been annotated. -
format
This is the format used to style the paths created. -
label
This is the label used to expose the annotation details.
-
-
Constructor Details
-
Introspector
Constructor for theIntrospector
object. This is used to create an object that will use information available within the field and annotation to determine exactly what the name of the XML element is to be and the type to use.- Parameters:
contact
- this is the method or field contact usedlabel
- this is the annotation on the contact objectformat
- this is used to style the paths created
-
-
Method Details
-
getContact
This is used to acquire theContact
for this. The contact is the actual method or field that has been annotated and is used to set or get information from the object instance.- Returns:
- the method or field that this signature represents
-
getDependent
This returns the dependent type for the annotation. This type is the type other than the annotated field or method type that the label depends on. For theElementList
this can be the generic parameter to an annotated collection type.- Returns:
- this is the type that the annotation depends on
- Throws:
Exception
-
getEntry
This method is used to get the entry name of a label using the type of the label. This ensures that if there is no entry XML element name declared by the annotation that a suitable name can be calculated from the annotated type.- Returns:
- this returns a suitable XML entry element name
- Throws:
Exception
-
getName
This is used to acquire the name of the specified type using theRoot
annotation for the class. This will use either the name explicitly provided by the annotation or it will use the name of the class that the annotation was placed on if there is no explicit name for the root.- Parameters:
type
- this is the type to acquire the root name for- Returns:
- this returns the name of the type from the root
- Throws:
Exception
- if the class contains an illegal schema
-
getRoot
This will acquire the name of theRoot
annotation for the specified class. This will traverse the inheritance hierarchy looking for the root annotation, when it is found it is used to acquire a name for the XML element it represents.- Parameters:
type
- this is the type to acquire the root name with- Returns:
- the root name for the specified type if it exists
-
getRoot
This will acquire the name of theRoot
annotation for the specified class. This will traverse the inheritance hierarchy looking for the root annotation, when it is found it is used to acquire a name for the XML element it represents.- Parameters:
real
- the actual type of the object being searchedtype
- this is the type to acquire the root name with- Returns:
- the root name for the specified type if it exists
-
getName
This is used to determine the name of the XML element that the annotated field or method represents. This will determine based on the annotation attributes and the dependent type required what the name of the XML element this represents is.- Returns:
- this returns the name of the XML element expected
- Throws:
Exception
-
getDefault
This is used to acquire the name for an element by firstly checking for an override in the annotation. If one exists then this is returned if not then the name of the field or method contact is returned.- Returns:
- this returns the XML element name to be used
- Throws:
Exception
-
getExpression
This method is used to return an XPath expression that is used to represent the position of a label. If there is no XPath expression associated with this then an empty path is returned. This will never return a null expression.- Returns:
- the XPath expression identifying the location
- Throws:
Exception
-
getPath
This is used to acquire the path of the element or attribute that is used by the class schema. The path is determined by acquiring the XPath expression and appending the name of the label to form a fully qualified path.- Returns:
- returns the path that is used for the XML property
- Throws:
Exception
-
isEmpty
This method is used to determine if a root annotation value is an empty value. Rather than determining if a string is empty be comparing it to an empty string this method allows for the value an empty string represents to be changed in future.- Parameters:
value
- this is the value to determine if it is empty- Returns:
- true if the string value specified is an empty value
-
toString
This method is used to construct a string that describes the signature of an XML annotated field or method. This will use theContact
object and the annotation used for that contact to construct a string that has sufficient information such that it can be used in error reporting.
-