org.apache.felix.dm.annotation.api
Annotation Type PropertyMetaData


@Retention(value=CLASS)
@Target(value=ANNOTATION_TYPE)
public @interface PropertyMetaData

This annotation describes the data types of a configuration Property. It can be used by other annotations which require meta type support. For now, the following annotations are using PropertyMetaData

  • ConfigurationDependency: This dependency allows to define a dependency over a Configuration Admin configuration dictionaries, whose metadata can be described using PropertyMetaData annotation.
  • FactoryConfigurationAdapterService: This service adapter allows to dynamically create Services on behalf of Factory Configuration Admin configuration dictionaries, whose metadata can be described using this PropertyMetaData annotation.


    Required Element Summary
     String description
              Returns the property description.
     String heading
              The label used to display the property.
     String id
              The key of a ConfigurationAdmin property.
     
    Optional Element Summary
     int cardinality
              Return the cardinality of this property.
     String[] defaults
              Return a default for this property.
     String[] optionLabels
              Return a list of valid option labels for this property.
     String[] optionValues
              Return a list of option values that this property can take.
     boolean required
              Tells if this property is required or not.
      type
              Return the property primitive type.
     

    Element Detail

    heading

    public abstract String heading
    The label used to display the property. Example: "Log Level".

    Returns:
    The label used to display the property

    id

    public abstract String id
    The key of a ConfigurationAdmin property. Example: "printer.logLevel"

    Returns:
    The Configuration Admin property name

    description

    public abstract String description
    Returns the property description. The description may be localized and must describe the semantics of this type and any constraints. Example: "Select the log level for the Printer Service".

    Returns:
    The localized description of the definition.

    type

    public abstract  type
    Return the property primitive type. If must be either one of the following types:

    • String.class
    • Long.class
    • Integer.class
    • Character.class
    • Byte.class
    • Double.class
    • Float.class
    • Boolean.class

    Default:

    defaults

    public abstract String[] defaults
    Return a default for this property. The object must be of the appropriate type as defined by the cardinality and getType(). The return type is a list of String objects that can be converted to the appropriate type. The cardinality of the return array must follow the absolute cardinality of this type. E.g. if the cardinality = 0, the array must contain 1 element. If the cardinality is 1, it must contain 0 or 1 elements. If it is -5, it must contain from 0 to max 5 elements. Note that the special case of a 0 cardinality, meaning a single value, does not allow arrays or vectors of 0 elements.

    Default:
    {}

    cardinality

    public abstract int cardinality
    Return the cardinality of this property. The OSGi environment handles multi valued properties in arrays ([]) or in Vector objects. The return value is defined as follows:

    • x = Integer.MIN_VALUE no limit, but use Vector
    • x < 0 -x = max occurrences, store in Vector
    • x > 0 x = max occurrences, store in array []
    • x = Integer.MAX_VALUE no limit, but use array []
    • x = 0 1 occurrence required

    Default:
    0

    required

    public abstract boolean required
    Tells if this property is required or not.

    Default:
    true

    optionLabels

    public abstract String[] optionLabels
    Return a list of valid option labels for this property. The purpose of this method is to allow menus with localized labels. It is associated with the optionValues() attribute. The labels returned here are ordered in the same way as the optionValues() attribute values.

    Returns:
    the list of valid option labels for this property.
    Default:
    {}

    optionValues

    public abstract String[] optionValues
    Return a list of option values that this property can take. This list must be in the same sequence as the optionLabels() attribute.

    Default:
    {}


    Copyright © 2011 Apache Software Foundation. All Rights Reserved.