org.osgi.service.metatype.annotations
Annotation Type AttributeDefinition


@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:

This id is the value of the id attribute of the generate AD element and is used as the name of the corresponding configuration property.

This annotation is not processed at runtime. It must be processed by tools and used to generate a Meta Type Resource document for the bundle.

Author:
$Id: ca91813a438f2d1de3af11c77e4c04cdb9ecd342 $
See Also:
"The AD element of a Meta Type Resource."

Optional Element Summary
 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.
 

name

public abstract String name
The 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) 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.

See Also:
"The name attribute of the AD element of a Meta Type Resource."
Default:
""

description

public abstract String description
The 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 be localized.

See Also:
"The description attribute of the AD element of a Meta Type Resource."
Default:
""

type

public abstract AttributeType type
The 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 and Enum are mapped to STRING. 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:
org.osgi.service.metatype.annotations.AttributeType.STRING

cardinality

public abstract int cardinality
The cardinality of this AttributeDefinition.

If not specified, the cardinality is derived from the return type of the annotated method. For non-array and non-Collection return types, that is a scalar type, the cardinality is 0. For array return types, the cardinality is a large positive value. For Collection return types, the cardinality is a large negative value.

See Also:
"The cardinality attribute of the AD element of a Meta Type Resource."
Default:
0

min

public abstract String min
The 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

public abstract String max
The 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

public abstract String[] defaultValue
The default value for this AttributeDefinition.

If not specified, if the annotated element is part of an annotation and has a default value, then the value is the default 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

public abstract boolean required
The 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

public abstract Option[] options
The option information for this AttributeDefinition.

For each specified Option, an Option element is generated for this AttributeDefinition. If not specified, no Option elements will be generated.

See Also:
"The Option element of a Meta Type Resource."
Default:
{}


Copyright © 2014 aQute SARL. All rights reserved.