Package org.simpleframework.xml.core
Interface Parameter
-
- All Known Implementing Classes:
AttributeParameter
,CacheParameter
,ElementArrayParameter
,ElementListParameter
,ElementListUnionParameter
,ElementMapParameter
,ElementMapUnionParameter
,ElementParameter
,ElementUnionParameter
,TemplateParameter
,TextParameter
interface Parameter
TheParameter
is used to represent a constructor parameter. It contains the XML annotation used on the parameter as well as the name of the parameter and its position index. A parameter is used to validate against the annotated methods and fields and also to determine the deserialized values that should be injected in to the constructor to instantiate it.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.annotation.Annotation
getAnnotation()
This is used to acquire the annotation that is used for the parameter.Expression
getExpression()
This method is used to return an XPath expression that is used to represent the position of this parameter.int
getIndex()
This returns the index position of the parameter in the constructor.java.lang.Object
getKey()
This is the key used to represent the parameter.java.lang.String
getName()
This is used to acquire the name of the parameter that this represents.java.lang.String
getPath()
This is used to acquire the path of the element or attribute represented by this parameter.java.lang.Class
getType()
This is used to acquire the annotated type class.boolean
isAttribute()
This method is used to determine if the parameter represents an attribute.boolean
isPrimitive()
This is used to determine if the parameter is primitive.boolean
isRequired()
This is used to determine if the parameter is required.boolean
isText()
This is used to determine if the parameter represents text.java.lang.String
toString()
This is used to provide a textual representation of the parameter.
-
-
-
Method Detail
-
getKey
java.lang.Object getKey()
This is the key used to represent the parameter. The key is used to store the parameter in hash containers. Unlike the path is not necessarily the path for the parameter.- Returns:
- this is the key used to represent the parameter
-
getType
java.lang.Class getType()
This is used to acquire the annotated type class. The class is the type that is to be deserialized from the XML. This is used to validate against annotated fields and methods.- Returns:
- this returns the type used for the parameter
-
getIndex
int getIndex()
This returns the index position of the parameter in the constructor. This is used to determine the order of values that are to be injected in to the constructor.- Returns:
- this returns the index for the parameter
-
getAnnotation
java.lang.annotation.Annotation getAnnotation()
This is used to acquire the annotation that is used for the parameter. The annotation provided will be an XML annotation such as theElement
orAttribute
annotation.- Returns:
- this returns the annotation used on the parameter
-
getExpression
Expression getExpression()
This method is used to return an XPath expression that is used to represent the position of this parameter. 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
-
getName
java.lang.String getName()
This is used to acquire the name of the parameter that this represents. The name is determined using annotation and the name attribute of that annotation, if one is provided.- Returns:
- this returns the name of the annotated parameter
-
getPath
java.lang.String getPath()
This is used to acquire the path of the element or attribute represented by this parameter. 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 this parameter
-
isRequired
boolean isRequired()
This is used to determine if the parameter is required. If an attribute is not required then it can be null. Which means that we can inject a null value. Also, this means we can match constructors in a more flexible manner.- Returns:
- this returns true if the parameter is required
-
isPrimitive
boolean isPrimitive()
This is used to determine if the parameter is primitive. A primitive parameter must not be null. As there is no way to provide the value to the constructor. A default value is not a good solution as it affects the constructor score.- Returns:
- this returns true if the parameter is primitive
-
isAttribute
boolean isAttribute()
This method is used to determine if the parameter represents an attribute. This is used to style the name so that elements are styled as elements and attributes are styled as required.- Returns:
- this is used to determine if this is an attribute
-
isText
boolean isText()
This is used to determine if the parameter represents text. If this represents text it typically does not have a name, instead the empty string represents the name. Also text parameters can not exist with other text parameters.- Returns:
- returns true if this parameter represents text
-
toString
java.lang.String toString()
This is used to provide a textual representation of the parameter. Providing a string describing the parameter is useful for debugging and for exception messages.- Overrides:
toString
in classjava.lang.Object
- Returns:
- this returns the string representation for this
-
-