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
-
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 TypeMethodDescriptionReturns the context of the configuration parameter.Returns the default value of the configuration parameter.Returns a human readable description for the configuration parameter.Returns a list of filter criteria for a dynamically created selection list.Returns a the group for this configuration parameter.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.getName()
Returns the name of the configuration parameter.Returns a static selection list for the value of this parameter.getType()
Returns the data type of the configuration parameter.getUnit()
Returns the unit of measurements of this parameter.Returns the unit label of this parameter.boolean
Returns true is the parameter is considered an advanced option.boolean
Returnstrue
if the configuration parameter has to be set, otherwisefalse
.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 (neither null, nor empty)
-
getType
Returns the data type of the configuration parameter.- Returns:
- the data type of the configuration parameter (not null)
-
getMinimum
- Returns:
- the minimal value for numeric types, or the minimal length of strings, or the minimal number of selected options (nullable)
-
getMaximum
- Returns:
- the maximal value for numeric types, or the maximal length of strings, or the maximal number of selected options (nullable)
-
getStepSize
- Returns:
- the value granularity for a numeric value (nullable)
-
getPattern
- Returns:
- the regular expression for a text type (nullable)
-
isReadOnly
- Returns:
- true if the value is required, otherwise false.
-
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. - password: A password value (a user-interface might obscure the visible value) - password-create: A passwort generator widget might be shown - color: This value represents an RGB color value like #ffffff or 12,12,12. - date: A date string - time: A time string - cronexpression: A cron expression like "* * * * *". A user interface would probably show a cron expression generator. - datetime: A date and time string - email: The configuration value represents an email address - month: A number [1-12] - week: A week [0-52] - tel: A tel no - url: A web address - script: The configuration value represents a script (javascript, python etc). A user-interface would probably render a multi line editor. - location: A lat,long,alt GPS location. A user-interface would probably render a world map for selection. - 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. - channel: A valid channel UID. - channeltype: A valid channel type UID. A user-interface would probably show a channel type 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. - rule: A valid rule uid. A user-interface would probably show a rule selection widget.- Returns:
- the context of the configuration parameter (could be null or 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 (could be null)
-
getLabel
Returns a human readable label for the configuration parameter.- Returns:
- a human readable label for the configuration parameter (could be null or empty)
-
getGroupName
Returns a the group for this configuration parameter.- Returns:
- a group for the configuration parameter (could be null or 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 null or 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 (could be null)
-
getUnitLabel
Returns the unit label of this parameter.- Returns:
- the unit label of this parameter (could be null)
-
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
-