|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.deployment.rp.autoconf.AttributeDefinitionImpl
public class AttributeDefinitionImpl
Field Summary |
---|
Fields inherited from interface org.osgi.service.metatype.AttributeDefinition |
---|
BIGDECIMAL, BIGINTEGER, BOOLEAN, BYTE, CHARACTER, DOUBLE, FLOAT, INTEGER, LONG, SHORT, STRING |
Constructor Summary | |
---|---|
AttributeDefinitionImpl(AD ad)
|
Method Summary | |
---|---|
int |
getCardinality()
Return the cardinality of this attribute. |
String[] |
getDefaultValue()
Return a default for this attribute. |
String |
getDescription()
Return a description of this attribute. |
String |
getID()
Unique identity for this attribute. |
String |
getName()
Get the name of the attribute. |
String[] |
getOptionLabels()
Return a list of labels of option values. |
String[] |
getOptionValues()
Return a list of option values that this attribute can take. |
int |
getType()
Return the type for this attribute. |
String |
validate(String value)
Validate an attribute in String form. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AttributeDefinitionImpl(AD ad)
Method Detail |
---|
public int getCardinality()
AttributeDefinition
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
getCardinality
in interface AttributeDefinition
public String[] getDefaultValue()
AttributeDefinition
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.
getDefaultValue
in interface AttributeDefinition
null
if no default exists.public String getDescription()
AttributeDefinition
getDescription
in interface AttributeDefinition
public String getID()
AttributeDefinition
cn
or commonName
must always be a String
and the semantics are always a name of some object. They share this
aspect with LDAP/X.500 attributes. In these standards the OSI Object
Identifier (OID) is used to uniquely identify an attribute. If such an
OID exists, (which can be requested at several standard organisations and
many companies already have a node in the tree) it can be returned here.
Otherwise, a unique id should be returned which can be a Java class name
(reverse domain name) or generated with a GUID algorithm. Note that all
LDAP defined attributes already have an OID. It is strongly advised to
define the attributes from existing LDAP schemes which will give the OID.
Many such schemes exist ranging from postal addresses to DHCP parameters.
getID
in interface AttributeDefinition
public String getName()
AttributeDefinition
getName
in interface AttributeDefinition
public String[] getOptionLabels()
AttributeDefinition
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" }
.
getOptionLabels
in interface AttributeDefinition
public String[] getOptionValues()
AttributeDefinition
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" }
.
getOptionValues
in interface AttributeDefinition
public int getType()
AttributeDefinition
Defined in the following constants which map to the appropriate Java
type. STRING
,LONG
,INTEGER
,
CHAR
,BYTE
,DOUBLE
,FLOAT
,
BOOLEAN
.
getType
in interface AttributeDefinition
public String validate(String value)
AttributeDefinition
String
form.
An attribute might be further constrained in value. This method will
attempt to validate the attribute according to these constraints. It can
return three different values:
null No validation present "" No problems detected "..." A localized description of why the value is wrong
validate
in interface AttributeDefinition
value
- The value before turning it into the basic data type
null
, "", or another string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |