Annotation Interface Property
ConfigurationDescription.
When a property is declared in a configuration description of a component,
the configuration (in the form of a Properties-object)
that is received by an instance of that component always contains a
value for that property. This value was either explicitly set in the
configuration or it's the default value assigned to the property.
A property is either required or a
default value that matches the type
and the restrictions of the property must be
specified. The default default value is the empty string, so omitting
the default value of an optional property may work where it fits the type and
restrictions.
TODO: Where to use the description? Add it to the exception message in case of illegal property values? Might also be used in a graphical configuration tool (if we should ever get one).
- Author:
- Patrick Schmidt
-
Nested Class Summary
Nested Classes -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether an empty string as default value is to be interpreted asnull.The default value of the property.A short description of the component.booleanWhether the configuration description is only for documentation purpose, that is, it should be part of the generated configuration documentation but it should not be considered within the actual configuration.booleanWhether the property is required in configurations.String[]Further restrictions on the allowed values of a property.SeeProperty.Typefor more information on which string values are legal string representations of the respective type.
-
Element Details
-
name
String nameThe name of the property, e.g.isCaching.- Returns:
- name of the property
-
-
-
description
String descriptionA short description of the component.- Returns:
- short description of the component
- Default:
- ""
-
isRequired
boolean isRequiredWhether the property is required in configurations. Otherwise thedefaultValue()will be used (i.e. it will be transparently filled into theconfigurationof the component.Please note, in case of
Property.Type.STRING, a required property also means the value must be non-empty!- Returns:
- whether the property is required in configurations
- Default:
- false
-
type
Property.Type typeSeeProperty.Typefor more information on which string values are legal string representations of the respective type.- Returns:
- the data type of the property
- Default:
- STRING
-
defaultValue
String defaultValueThe default value of the property. IfisRequired()is set totruethedefaultValueis ignored. Otherwise it has to be a legal string representation of the type defined intype(). If the property is not required and no default value is provided, the empty string will be used, that is, the empty string is the default for the default value.- Returns:
- The default value of the property.
- Default:
- ""
-
defaultNull
boolean defaultNullWhether an empty string as default value is to be interpreted asnull. This attribute is only relevant in case the default value is set to the empty string (or not provided at all).- Returns:
- Whether an empty string as default should be interpreted as
nullinstead of the empty string.
- Default:
- false
-
documentationOnly
boolean documentationOnlyWhether the configuration description is only for documentation purpose, that is, it should be part of the generated configuration documentation but it should not be considered within the actual configuration. For instance, the configuration of component/service types and instances should be documented but cannot be retrieved from the static configuration description.- Default:
- false
-
restrictions
String[] restrictionsFurther restrictions on the allowed values of a property. Restrictions are expressed through strings of the format:<restrictionType>: <restrictionData>or<restrictionType>/<restrictionOptions>: <restrictionData>. The following restriction types are available:- oneof: a comma-separated list of allowed values. Whitespace
around the commas is discarded. By default the values are treated
case-sensitive. Use i as option for case-insensitive comparisons.
Example:
oneof: apple, orange, banana
oneof/i: apple, orange, banana(case-insensitive comparison) - length: a restriction on the length of values, either a fixed
length or a range.
xcan be used as a wildcard.
Examples:
length: 5(a fixed length)
length: 1 to 6
length: 1 to x(minimum length of 1 and no maximum length) - pattern: a regular expression the values have to match.
Leading and trailing whitespace around the pattern is ignored; use
parentheses if it's important. By default the pattern matching is
case-sensitive. Use i as option for case-insensitive matching.
Example:
pattern: prefix.*
SeePatternfor more information an regular expression patterns in Java. - range: an interval of allowed values (only available for
number types).
xcan be used as a wildcard. Intervals may be open ((or closed ([) (closed is default if omitted).
Examples:
range: 1 to 6(values between 1 and 6, boundaries included)
range: [1 to 6](equal to previous example)
range: 0 to 1)(values between 0 and 1, right boundary not included)
range: 5 to x(minimum of 5, no maximum)
range: x to 8(maximum of 8, no minimum)
- Returns:
- further restrictions on the allowed values of a property
- Default:
- {}
- oneof: a comma-separated list of allowed values. Whitespace
around the commas is discarded. By default the values are treated
case-sensitive. Use i as option for case-insensitive comparisons.
-