@Retention(value=CLASS) @Target(value=METHOD) public @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. The annotated method name is processed from left to right
changing each character as follows:
'$'
\u0024) is removed unless it is followed
by another dollar sign in which case the two consecutive dollar signs (
'$$'
) are changed to a single dollar sign.'_'
\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.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.
Modifier and Type | Optional Element and Description |
---|---|
int |
cardinality
The cardinality of this AttributeDefinition.
|
String[] |
defaultValue
The default value for this AttributeDefinition.
|
String |
description
The human readable description of this AttributeDefinition.
|
String |
max
The maximum value for this AttributeDefinition.
|
String |
min
The minimum value for this AttributeDefinition.
|
String |
name
The human readable name of this AttributeDefinition.
|
Option[] |
options
The option information for this AttributeDefinition.
|
boolean |
required
The required value for this AttributeDefinition.
|
AttributeType |
type
The type of this AttributeDefinition.
|
public abstract String name
If not specified, the name of this AttributeDefinition is derived from
the name of the annotated method. For example, low line ('_'
\u005F) and dollar sign ('$'
\u0024) 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 be localized
.
public abstract String description
If not specified, the description of this AttributeDefinition is the empty string.
If the description begins with the percent sign ('%'
\u0025),
the description can be localized
.
public abstract AttributeType type
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
and Enum
are
mapped to STRING
. If the return type is
List
, Set
, Collection
, Iterable
or some
type which can be determined at annotation processing time to
Collection
andList<String>
will be mapped to
STRING
. 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 to
STRING
. A tool processing the annotation
should declare an error for unsupported return types.public abstract int cardinality
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
Collection
andpublic abstract String min
If not specified, there is no minimum value.
public abstract String max
If not specified, there is no maximum value.
public abstract String[] defaultValue
The specified values are concatenated into a comma delimited list to
become the value of the default
attribute of the generated
AD
element.
If not specified and the annotated method is an annotation element that
has a default
value, then the value of this element is the
default
value of the annotated element. Otherwise, there is no
default value.
public abstract boolean required
If not specified, the value is true
.
public abstract Option[] options
For each specified Option
, an Option
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 an enum
, or a List
, Set
,
Collection
, Iterable
or some type which can be determined
at annotation processing time to
Collection
andenum
, then the value of this element
has an Option
for each value of the enum
. The label and
value of each Option
are set to the name of the corresponding
enum
value. Otherwise, no Option
elements will be
generated.Copyright © OSGi Alliance (2000, 2015). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0