Package org.apache.felix.metatype
Class AD
- java.lang.Object
-
- org.apache.felix.metatype.OptionalAttributes
-
- org.apache.felix.metatype.AD
-
public class AD extends OptionalAttributes
TheADclass represents theADelement of the meta type descriptor.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVALIDATE_GREATER_THAN_MAXIMUMThe message returned from thevalidate(String)method if the value is greater than the specifiedmaximum value(value is "%greater than maximum").static java.lang.StringVALIDATE_INVALID_VALUEThe message returned from thevalidate(String)method if the value is invalid considering its type (value is "%invalid value").static java.lang.StringVALIDATE_LESS_THAN_MINIMUMThe message returned from thevalidate(String)method if the value is less than the specifiedminimum value(value is "%less than minimum").static java.lang.StringVALIDATE_MISSINGThe message returned from thevalidate(String)method if the value is null or cannot be converted to an attribute value and a value isrequired(value is "%missing required value").static java.lang.StringVALIDATE_NOT_A_VALID_OPTIONThe message returned from thevalidate(String)method if the value is not any of the specifiedoption values(value is "%not a valid option").
-
Constructor Summary
Constructors Constructor Description AD()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCardinality()java.lang.String[]getDefaultValue()java.lang.StringgetDescription()java.lang.StringgetID()java.lang.StringgetMax()java.lang.StringgetMin()java.lang.StringgetName()java.lang.String[]getOptionLabels()java.lang.String[]getOptionValues()intgetType()booleanisRequired()voidsetCardinality(int cardinality)voidsetDefaultValue(java.lang.String defaultValue)Sets the default value(s) for this AD.voidsetDescription(java.lang.String description)voidsetID(java.lang.String id)voidsetMax(java.lang.String max)voidsetMin(java.lang.String min)voidsetName(java.lang.String name)voidsetOptions(java.util.Map options)voidsetRequired(boolean isRequired)voidsetType(java.lang.String typeString)static java.lang.String[]splitList(java.lang.String listString)static inttoType(java.lang.String typeString)java.lang.Stringvalidate(java.lang.String valueString)Implements validation of thevalueStringand returns an indication of the validation result.-
Methods inherited from class org.apache.felix.metatype.OptionalAttributes
addOptionalAttribute, getOptionalAttributes
-
-
-
-
Field Detail
-
VALIDATE_NOT_A_VALID_OPTION
public static final java.lang.String VALIDATE_NOT_A_VALID_OPTION
The message returned from thevalidate(String)method if the value is not any of the specifiedoption values(value is "%not a valid option").- See Also:
- Constant Field Values
-
VALIDATE_INVALID_VALUE
public static final java.lang.String VALIDATE_INVALID_VALUE
The message returned from thevalidate(String)method if the value is invalid considering its type (value is "%invalid value").- See Also:
- Constant Field Values
-
VALIDATE_GREATER_THAN_MAXIMUM
public static final java.lang.String VALIDATE_GREATER_THAN_MAXIMUM
The message returned from thevalidate(String)method if the value is greater than the specifiedmaximum value(value is "%greater than maximum").- See Also:
- Constant Field Values
-
VALIDATE_LESS_THAN_MINIMUM
public static final java.lang.String VALIDATE_LESS_THAN_MINIMUM
The message returned from thevalidate(String)method if the value is less than the specifiedminimum value(value is "%less than minimum").- See Also:
- Constant Field Values
-
VALIDATE_MISSING
public static final java.lang.String VALIDATE_MISSING
The message returned from thevalidate(String)method if the value is null or cannot be converted to an attribute value and a value isrequired(value is "%missing required value").- See Also:
- Constant Field Values
-
-
Method Detail
-
getID
public java.lang.String getID()
-
getName
public java.lang.String getName()
-
getDescription
public java.lang.String getDescription()
-
getType
public int getType()
-
getCardinality
public int getCardinality()
-
getOptionLabels
public java.lang.String[] getOptionLabels()
-
getOptionValues
public java.lang.String[] getOptionValues()
-
getDefaultValue
public java.lang.String[] getDefaultValue()
-
getMin
public java.lang.String getMin()
-
getMax
public java.lang.String getMax()
-
isRequired
public boolean isRequired()
-
validate
public java.lang.String validate(java.lang.String valueString)
Implements validation of thevalueStringand returns an indication of the validation result.- Parameters:
valueString- The string representation of the value to validate, can benull.- Returns:
nullif no validation is performed, "" if the value is accepted as valid, or a non-empty string indicating a validation problem was found.- See Also:
ADValidator.validate(AD, String),VALIDATE_GREATER_THAN_MAXIMUM,VALIDATE_NOT_A_VALID_OPTION,VALIDATE_LESS_THAN_MINIMUM,VALIDATE_INVALID_VALUE,VALIDATE_MISSING
-
setID
public void setID(java.lang.String id)
- Parameters:
id- the id to set
-
setName
public void setName(java.lang.String name)
- Parameters:
name- the name to set
-
setDescription
public void setDescription(java.lang.String description)
- Parameters:
description- the description to set
-
setType
public void setType(java.lang.String typeString)
- Parameters:
typeString- the type to set
-
setCardinality
public void setCardinality(int cardinality)
- Parameters:
cardinality- the cardinality to set
-
setOptions
public void setOptions(java.util.Map options)
- Parameters:
options- the options to set
-
setDefaultValue
public void setDefaultValue(java.lang.String defaultValue)
Sets the default value(s) for this AD.NOTE: this method is depending on the value of
getCardinality()! Make sure that the cardinality is properly set before calling this method.- Parameters:
defaultValue- the default value to set, as encoded string-value (using comma's as separator), can benull.
-
setMin
public void setMin(java.lang.String min)
- Parameters:
min- the min to set
-
setMax
public void setMax(java.lang.String max)
- Parameters:
max- the max to set
-
setRequired
public void setRequired(boolean isRequired)
- Parameters:
isRequired- the isRequired to set
-
toType
public static int toType(java.lang.String typeString)
-
splitList
public static java.lang.String[] splitList(java.lang.String listString)
-
-