Class ConfigDescriptionParameter


  • public class ConfigDescriptionParameter
    extends Object
    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
    • Constructor Detail

      • ConfigDescriptionParameter

        public ConfigDescriptionParameter()
        Default constructor.
      • ConfigDescriptionParameter

        public ConfigDescriptionParameter​(String name,
                                          ConfigDescriptionParameter.Type type)
                                   throws IllegalArgumentException
        Creates a new instance of this class with the specified parameters.
        Parameters:
        name - the name of the configuration parameter (must neither be null nor empty)
        type - the data type of the configuration parameter (must not be null)
        Throws:
        IllegalArgumentException - if the name is null or empty, or the type is null
    • Method Detail

      • getName

        public String getName()
        Returns the name of the configuration parameter.
        Returns:
        the name of the configuration parameter (neither null, nor empty)
      • getType

        public ConfigDescriptionParameter.Type getType()
        Returns the data type of the configuration parameter.
        Returns:
        the data type of the configuration parameter (not null)
      • getMinimum

        public BigDecimal getMinimum()
        Returns:
        the minimal value for numeric types, or the minimal length of strings, or the minimal number of selected options (nullable)
      • getMaximum

        public BigDecimal getMaximum()
        Returns:
        the maximal value for numeric types, or the maximal length of strings, or the maximal number of selected options (nullable)
      • getStepSize

        public BigDecimal getStepSize()
        Returns:
        the value granularity for a numeric value (nullable)
      • getPattern

        public String getPattern()
        Returns:
        the regular expression for a text type (nullable)
      • 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

        public Integer getMultipleLimit()
        Returns:
        the maximum number of options that can be selected from the options list
      • getContext

        public String 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()
        Returns true if the configuration parameter has to be set, otherwise false.
        Returns:
        true if the configuration parameter has to be set, otherwise false
      • getDefault

        public String getDefault()
        Returns the default value of the configuration parameter.
        Returns:
        the default value of the configuration parameter (could be null)
      • getLabel

        public String 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

        public String 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

        public String 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

        public List<ParameterOption> getOptions()
        Returns a static selection list for the value of this parameter.
        Returns:
        static selection list for the value of this parameter
      • getFilterCriteria

        public List<FilterCriteria> 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

        public String getUnit()
        Returns the unit of measurements of this parameter.
        Returns:
        the unit of measurements of this parameter (could be null)
      • getUnitLabel

        public String getUnitLabel()
        Returns the unit label of this parameter.
        Returns:
        the unit label of this parameter (could be null)
      • 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