Annotation Type Property
-
@Target({}) public @interface Property
The definition of a configuration property in aConfigurationDescription
.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 adefault value
that matches thetype
and therestrictions
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
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
defaultNull
Whether an empty string as default value is to be interpreted asnull
.String
defaultValue
The default value of the property.String
description
A short description of the component.boolean
documentationOnly
Whether 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.boolean
isRequired
Whether the property is required in configurations.String[]
restrictions
Further restrictions on the allowed values of a property.Property.Type
type
SeeProperty.Type
for more information on which string values are legal string representations of the respective type.
-
-
-
Element Detail
-
name
String name
The name of the property, e.g.isCaching
.- Returns:
- name of the property
-
-
-
description
String description
A short description of the component.- Returns:
- short description of the component
- Default:
- ""
-
-
-
isRequired
boolean isRequired
Whether the property is required in configurations. Otherwise thedefaultValue()
will be used (i.e. it will be transparently filled into theconfiguration
of 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 type
SeeProperty.Type
for more information on which string values are legal string representations of the respective type.- Returns:
- the data type of the property
- Default:
- de.aristaflow.adept2.base.configuration.Property.Type.STRING
-
-
-
defaultValue
String defaultValue
The default value of the property. IfisRequired()
is set totrue
thedefaultValue
is 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 defaultNull
Whether 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
null
instead of the empty string.
- Default:
- false
-
-
-
documentationOnly
boolean documentationOnly
Whether 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[] restrictions
Further 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.
x
can 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.*
SeePattern
for more information an regular expression patterns in Java. - range: an interval of allowed values (only available for
number types).
x
can 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.
-
-