@Target(value={TYPE,FIELD}) @Retention(value=CLASS) @Documented public @interface Property
Property
annotation defines properties which are made
available to the component through the ComponentContext.getProperties()
method. These annotations are not strictly required but may be used by
components to defined initial configuration. Additionally properties may be
set here to identify the component if it is registered as a service, for
example the service.description and service.vendor properties.
This tag is used to declare <property> elements of the component declaration. See section 112.4.5, Properties and Property Elements, in the OSGi Service Platform Service Compendium Specification for more information.
Modifier and Type | Optional Element and Description |
---|---|
boolean[] |
boolValue
The bool value(s) of the property.
|
byte[] |
byteValue
The byte value(s) of the property.
|
int |
cardinality
Defines the cardinality of the property and its collection type.
|
char[] |
charValue
The char value(s) of the property.
|
Class<?>[] |
classValue
The class value(s) of the property.
|
String |
description
A descriptive text to provide the client in a form to configure this
property.
|
double[] |
doubleValue
The double value(s) of the property.
|
float[] |
floatValue
The float value(s) of the property.
|
int[] |
intValue
The int value(s) of the property.
|
String |
label
The label to display in a form to configure this property.
|
long[] |
longValue
The long value(s) of the property.
|
String |
name
The name of the property
|
PropertyOption[] |
options
Some properties may only be set to a set of possible values.
|
String[] |
passwordValue
The password value(s) of the property.
|
boolean |
propertyPrivate
Boolean flag defining whether a metatype descriptor entry should be
generated for this property or not.
|
short[] |
shortValue
The short value(s) of the property.
|
PropertyUnbounded |
unbounded
This defines if the property is unbounded.
|
String[] |
value
The value(s) of the property.
|
public abstract String name
public abstract String label
public abstract String description
public abstract String[] value
public abstract Class<?>[] classValue
public abstract long[] longValue
public abstract double[] doubleValue
public abstract float[] floatValue
public abstract int[] intValue
public abstract byte[] byteValue
public abstract char[] charValue
public abstract boolean[] boolValue
public abstract short[] shortValue
public abstract String[] passwordValue
public abstract int cardinality
Vector
(primitive types such as boolean are boxed in
the Wrapper class), if the cardinality is positive, the property is
stored in an array (primitve types are unboxed, that is Boolean type
values are stored in boolean[]). The actual value defines the maximum
number of elements in the vector or array. If the cardinality is
zero, the property is a scalar value. If the defined value of the
property is set in the value attribute, the cardinality defaults to 0
(zero for scalar value). If the property is defined in one or more
properties starting with values, the cardinality defaults to
an unbounded array.public abstract PropertyUnbounded unbounded
PropertyUnbounded.DEFAULT
,
this overrides the cardinality()
.public abstract boolean propertyPrivate
AD
element, is generated. If a property
should not be available for display in a configuration user interface,
this parameter should be set to true
. For properties names
service.ranking
the AD
element is not created
by default, which can be overwritten by stating
propertyPrivate=false
. For the predefined properties
service.pid
, service.description
,
service.id
, service.vendor
,
service.bundlelocation
and service.factoryPid
an AD
element will never be created and the
propertyPrivate
attribute has no effect.public abstract PropertyOption[] options
Property
annotation. All parameters in the form of name-value
pairs are used to build the list of available value options. The
parameter name is used as the value while the parameter value is used as
the label in the user interface. This label may be prepended with a %
sign to localize the string.
The options are written to the metatype.xml file as Option elements inside the AD element defining the property. The name of the parameter will be used for the Option.value attribute while the value of the parameter defines the Option.label attribute.
Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.