|
OSGi™ Service Platform Release 2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface to describe an attribute.
An AttributeDefinition object defines a description of the data type of a property/attribute.
Field Summary | |
static int |
BIGDECIMAL
The BIGDECIMAL(10) type. |
static int |
BIGINTEGER
The BIGINTEGER(9) type. |
static int |
BOOLEAN
The BOOLEAN(11) type. |
static int |
BYTE
The BYTE(6) type. |
static int |
CHARACTER
The CHARACTER(5) type. |
static int |
DOUBLE
The DOUBLE(7) type. |
static int |
FLOAT
The FLOAT(8) type. |
static int |
INTEGER
The INTEGER(3) type. |
static int |
LONG
The LONG(2) type. |
static int |
SHORT
The SHORT(4) type. |
static int |
STRING
The STRING(1) type. |
Method Summary | |
int |
getCardinality()
Return the cardinality of this attribute. |
java.lang.String[] |
getDefaultValue()
Return a default for this attribute. |
java.lang.String |
getDescription()
Return a description of this attribute. |
java.lang.String |
getID()
Unique identity for this attribute. |
java.lang.String |
getName()
Get the name of the attribute. |
java.lang.String[] |
getOptionLabels()
Return a list of labels of option values. |
java.lang.String[] |
getOptionValues()
Return a list of option values that this attribute can take. |
int |
getType()
Return the type for this attribute. |
java.lang.String |
validate(java.lang.String value)
Validate an attribute in String form. |
Field Detail |
public static final int STRING
Attributes of this type should be stored as String, Vector with String or String[] objects, depending on the getCardinality() value.
public static final int LONG
public static final int INTEGER
public static final int SHORT
public static final int CHARACTER
public static final int BYTE
public static final int DOUBLE
public static final int FLOAT
public static final int BIGINTEGER
public static final int BIGDECIMAL
public static final int BOOLEAN
Method Detail |
public java.lang.String getName()
public java.lang.String getID()
public java.lang.String getDescription()
public int getCardinality()
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
public int getType()
Defined in the following constants which map to the appropriate Java type. STRING, LONG, INTEGER, CHAR, BYTE, DOUBLE, FLOAT, BIGINTEGER, BIGDECIMAL, BOOLEAN.
public java.lang.String[] getOptionValues()
If the function returns null, there are no option values available.
Each value must be acceptable to validate() (return "") and must be a String object that can be converted to the data type defined by getType() for this attribute.
This list must be in the same sequence as getOptionLabels(). I.e. for each index i in getOptionValues, i in getOptionLabels() should be the label.
For example, if an attribute can have the value male, female, unknown, this list can return new String[] { "male", "female", "unknown" }.
public java.lang.String[] getOptionLabels()
The purpose of this method is to allow menus with localized labels. It is associated with getOptionValues. The labels returned here are ordered in the same way as the values in that method.
If the function returns null, there are no option labels available.
This list must be in the same sequence as the getOptionValues() method. I.e. for each index i in getOptionLabels, i in getOptionValues() should be the associated value.
For example, if an attribute can have the value male, female, unknown, this list can return (for dutch) new String[] { "Man", "Vrouw", "Onbekend" }.
public java.lang.String validate(java.lang.String value)
null no validation present "" no problems detected "..." A localized description of why the value is wrong
value
- The value before turning it into the basic data typepublic java.lang.String[] getDefaultValue()
|
OSGi™ Service Platform Release 2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |