Package org.openhab.core.config.core
Class ConfigDescriptionParameter
java.lang.Object
org.openhab.core.config.core.ConfigDescriptionParameter
The
ConfigDescriptionParameter
class contains the description of a
concrete configuration parameter. Such parameter descriptions are collected
within the ConfigDescription
and can be retrieved from the ConfigDescriptionRegistry
.
This class defines available configuration parameter types in ConfigDescriptionParameter.Type
,
it defines available unit types in UNITS
and available
contexts (see getContext()
).- Author:
- Michael Grammling - Initial contribution, Alex Tugarev - Added options, filter criteria, and more parameter attributes, Chris Jackson - Added groupId, limitToOptions, advanced, multipleLimit, verify attributes, Christoph Knauf - Added default constructor, changed Boolean getter to return primitive types, Thomas Höfer - Added unit, Laurent Garnier - Removed constraint on unit value, Florian Hotze - Add null annotations
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
TheConfigDescriptionParameter.Type
defines an enumeration of all supported data types a configuration parameter can take. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
Returns the context of the configuration parameter.@Nullable String
Returns the default value of the configuration parameter.@Nullable String
Returns a human-readable description for the configuration parameter.Returns a list of filter criteria for a dynamically created selection list.@Nullable String
Returns the group for this configuration parameter.@Nullable String
getLabel()
Returns a human-readable label for the configuration parameter.boolean
Returns true is the value for this parameter must be limited to the values in the options list.@Nullable BigDecimal
@Nullable BigDecimal
@Nullable Integer
getName()
Returns the name of the configuration parameter.Returns a static selection list for the value of this parameter.@Nullable String
@Nullable BigDecimal
Returns the value granularity for a numeric value.getType()
Returns the data type of the configuration parameter.@Nullable String
getUnit()
Returns the unit of measurements of this parameter.@Nullable String
Returns the unit label of this parameter.boolean
Returns true is the parameter is considered an advanced option.boolean
boolean
boolean
Returnstrue
if the configuration parameter has to be set, otherwisefalse
.boolean
Returns the verify flag for this parameter.toString()
-
Constructor Details
-
ConfigDescriptionParameter
public ConfigDescriptionParameter()Default constructor.
-
-
Method Details
-
getName
Returns the name of the configuration parameter.- Returns:
- the name of the configuration parameter (not empty)
-
getType
Returns the data type of the configuration parameter.- Returns:
- the data type of the configuration parameter
-
getMinimum
- Returns:
- the minimal value for numeric types, or the minimal length of strings, or the minimal number of selected options
-
getMaximum
- Returns:
- the maximal value for numeric types, or the maximal length of strings, or the maximal number of selected options
-
getStepSize
Returns the value granularity for a numeric value.By setting the step size to
0
, any granularity is allowed, i.e. any number of decimals is accepted.- Returns:
- the value granularity for a numeric value
-
getPattern
- Returns:
- the regular expression for a text type
-
isReadOnly
public boolean isReadOnly()- Returns:
- true if the value is required, otherwise false.
-
isMultiple
public boolean isMultiple()- Returns:
- true if multiple selections of options are allowed, otherwise false.
-
getMultipleLimit
- Returns:
- the maximum number of options that can be selected from the options list
-
getContext
Returns the context of the configuration parameter.A context is a hint for user interfaces and input validators.
Any string can be used, but the following have a special meaning:
- network-address: The configuration value represents an IPv4 or IPv6 address or domain name. - network-interface: The configuration value represents a network interface name, e.g. eth0, wlan0. - serial-port: The configuration value represents a serial port name, e.g. COM1, /dev/ttyS0. - password: A alphanumeric password value (a user-interface might obscure the visible value) - password-create: A alphanumeric passwort generator widget might be shown - color: This value represents an RGB color value like #000000 - #ffffff or 12,12,12. - date: A date string in the format "YYYY-MM-DD" - datetime: A date and time string in the format "YYYY-MM-DD'T'hh:mm:ss", e.g. "2019-12-31T23:59:59" - cronexpression: A cron expression like "* * * * *". A user interface would probably show a cron expression generator. - email: The configuration value represents an email address, e.g. [email protected] - month: A month of year [1-12] - week: A week of year [0-52] - dayOfWeek: A day of week [MON, TUE, WED, THU, FRI, SAT, SUN] - time: A time string in the format "hh:mm:ss" or as milliseconds since epoch - telephone: A tel no - url: A web address - tag: One tag or multiple tags separated by comma. - item: A valid item "name". A user-interface would probably show an item selection widget. - thing: A valid thing UID. A user-interface would probably show a thing selection widget. - group: A valid group item "name". A user-interface would probably show an item selection widget. - service: A valid service ID. A user-interface would probably show a service selection widget. - persistenceService: A valid persistence service ID. A user-interface would probably show a persistence service selection widget. - channel: A valid channel UID. A user-interface would probably show a channel selection widget. - channeltype: A valid channel type UID. A user-interface would probably show a channel type selection widget. - rule: A valid rule uid. A user-interface would probably show a rule selection widget. - script: The configuration value represents a script (javascript, python etc). A user-interface would probably render a multi line editor. - page: A valid page UID. A user-interface would probably show a page selection widget. - widget: A valid widget UID. A user-interface would probably show a widget selection widget. - location: A latitude,longitude[,altitude] GPS location. A user-interface would probably render a world map for selection.- Returns:
- the context of the configuration parameter (could be empty)
-
isRequired
public boolean isRequired()Returnstrue
if the configuration parameter has to be set, otherwisefalse
.- Returns:
- true if the configuration parameter has to be set, otherwise false
-
getDefault
Returns the default value of the configuration parameter.- Returns:
- the default value of the configuration parameter
-
getLabel
Returns a human-readable label for the configuration parameter.- Returns:
- a human-readable label for the configuration parameter (could be empty)
-
getGroupName
Returns the group for this configuration parameter.- Returns:
- a group for the configuration parameter (could be empty)
-
getLimitToOptions
public boolean getLimitToOptions()Returns true is the value for this parameter must be limited to the values in the options list.- Returns:
- true if the value is limited to the options list
-
isAdvanced
public boolean isAdvanced()Returns true is the parameter is considered an advanced option.- Returns:
- true if the value is an advanced option
-
getDescription
Returns a human-readable description for the configuration parameter.- Returns:
- a human-readable description for the configuration parameter (could be empty)
-
getOptions
Returns a static selection list for the value of this parameter.- Returns:
- static selection list for the value of this parameter
-
getFilterCriteria
Returns a list of filter criteria for a dynamically created selection list.The clients should consider the relation between the filter criteria and the parameter's context.
- Returns:
- list of filter criteria for a dynamically created selection list
-
getUnit
Returns the unit of measurements of this parameter.- Returns:
- the unit of measurements of this parameter
-
getUnitLabel
Returns the unit label of this parameter.- Returns:
- the unit label of this parameter
-
isVerifyable
public boolean isVerifyable()Returns the verify flag for this parameter. Verify parameters are considered dangerous and the user should be alerted with an "Are you sure" flag in the UI.- Returns:
- true if the parameter requires verification in the UI
-
toString
-