Annotation Interface AttributeDefinition
AttributeDefinition
information for the annotated method.
Each method of a type annotated by ObjectClassDefinition
has an
implied AttributeDefinition annotation. This annotation is only used to
specify non-default AttributeDefinition information.
The id
of this AttributeDefinition is generated from the name of the
annotated method as follows:
- A single dollar sign (
'$'
\u0024) is removed unless it is followed by:- A low line (
'_'
\u005F) and a dollar sign in which case the three consecutive characters ("$_$"
) are changed to a single hyphen-minus ('-'
\u002D). - Another dollar sign in which case the two consecutive dollar signs (
"$$"
) are changed to a single dollar sign.
- A low line (
- A low line (
'_'
\u005F) is changed to a full stop ('.'
\u002E) unless is it followed by another low line in which case the two consecutive low lines ("__"
) are changed to a single low line. - All other characters are unchanged.
- If the type declaring the method also declares a
PREFIX_
field whose value is a compile-time constant String, then the id is prefixed with the value of thePREFIX_
field.
ObjectClassDefinition
is a
single-element annotation, then the id for the value
method
is derived from the name of the annotation type rather than the name of the
method. In this case, the simple name of the annotation type, that is, the
name of the class without any package name or outer class name, if the
annotation type is an inner class, must be converted to the value
method's id as follows:
- When a lower case character is followed by an upper case character, a
full stop (
'.'
\u002E) is inserted between them. - Each upper case character is converted to lower case.
- All other characters are unchanged.
- If the annotation type declares a
PREFIX_
field whose value is a compile-time constant String, then the id is prefixed with the value of thePREFIX_
field.
This annotation is not processed at runtime. It must be processed by tools and used to contribute to a Meta Type Resource document for the bundle.
- See Also:
-
- "The AD element of a Meta Type Resource."
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionint
The cardinality of this AttributeDefinition.String[]
The default value for this AttributeDefinition.The human readable description of this AttributeDefinition.The maximum value for this AttributeDefinition.The minimum value for this AttributeDefinition.The human readable name of this AttributeDefinition.Option[]
The option information for this AttributeDefinition.boolean
The required value for this AttributeDefinition.The type of this AttributeDefinition.
-
Element Details
-
name
String nameThe human readable name of this AttributeDefinition.If not specified, the name of this AttributeDefinition is derived from the name of the annotated method. For example, low line (
'_'
\u005F), dollar sign ('$'
\u0024), and hyphen-minus ('-'
\u002D) are replaced with space (' '
\u0020) and space is inserted between camel case words.If the name begins with the percent sign (
'%'
\u0025), the name can belocalized
.- See Also:
-
- "The name attribute of the AD element of a Meta Type Resource."
- Default:
- ""
-
description
String descriptionThe human readable description of this AttributeDefinition.If not specified, the description of this AttributeDefinition is the empty string.
If the description begins with the percent sign (
'%'
\u0025), the description can belocalized
.- See Also:
-
- "The description attribute of the AD element of a Meta Type Resource."
- Default:
- ""
-
type
AttributeType typeThe type of this AttributeDefinition.This must be one of the defined
attributes types
.If not specified, the type is derived from the return type of the annotated method. Return types of
Class
andEnum
are mapped toSTRING
. If the return type isList
,Set
,Collection
,Iterable
or some type which can be determined at annotation processing time to- be a subtype of
Collection
and - have a public no argument constructor,
List<String>
will be mapped toSTRING
. A return type of a single dimensional array is supported and the type is the component type of the array. Multi dimensional arrays are not supported. Annotation return types are not supported. Any unrecognized type is mapped toSTRING
. A tool processing the annotation should declare an error for unsupported return types.- See Also:
-
- "The type attribute of the AD element of a Meta Type Resource."
- Default:
- STRING
- be a subtype of
-
cardinality
int cardinalityThe cardinality of this AttributeDefinition.If not specified, the cardinality is derived from the return type of the annotated method. For an array return type, the cardinality is a large positive value. If the return type is
List
,Set
,Collection
,Iterable
or some type which can be determined at annotation processing time to- be a subtype of
Collection
and - have a public no argument constructor,
- See Also:
-
- "The cardinality attribute of the AD element of a Meta Type Resource."
- Default:
- 0
- be a subtype of
-
min
String minThe minimum value for this AttributeDefinition.If not specified, there is no minimum value.
- See Also:
-
- "The min attribute of the AD element of a Meta Type Resource."
- Default:
- ""
-
max
String maxThe maximum value for this AttributeDefinition.If not specified, there is no maximum value.
- See Also:
-
- "The max attribute of the AD element of a Meta Type Resource."
- Default:
- ""
-
defaultValue
String[] defaultValueThe default value for this AttributeDefinition.The specified values are concatenated into a comma delimited list to become the value of the
default
attribute of the generatedAD
element.If not specified and the annotated method is an annotation element that has a
default
value, then the value of this element is thedefault
value of the annotated element. Otherwise, there is no default value.- See Also:
-
- "The default attribute of the AD element of a Meta Type Resource."
- Default:
- {}
-
required
boolean requiredThe required value for this AttributeDefinition.If not specified, the value is
true
.- See Also:
-
- "The required attribute of the AD element of a Meta Type Resource."
- Default:
- true
-
options
Option[] optionsThe option information for this AttributeDefinition.For each specified
Option
, anOption
element is generated for this AttributeDefinition.If not specified, the option information is derived from the return type of the annotated method. If the return type is an
enum
, a single dimensional array of anenum
, or aList
,Set
,Collection
,Iterable
or some type which can be determined at annotation processing time to- be a subtype of
Collection
and - have a public no argument constructor,
enum
, then the value of this element has anOption
for each value of theenum
. The label and value of eachOption
are set to the name of the correspondingenum
value. Otherwise, noOption
elements will be generated.- See Also:
-
- "The Option element of a Meta Type Resource."
- Default:
- {}
- be a subtype of
-