Class Input

java.lang.Object
org.openhab.core.automation.type.Input

@NonNullByDefault public class Input extends Object
This class defines meta-information properties, used by the Rule Engine when creating connections between modules. The Inputs of a Module are the entry points for data coming from other Modules. An Input can be connected to a single Output of another Module, which produces data of an acceptable type.

The meta-information contains:

  • name (mandatory) - unique ID in the scope of the Module
  • type (mandatory) - the acceptable data type for this Input. The value of this meta-info property could be any string that makes sense for the user, like a fully qualified name of a Java class, or a general description like "temperature", for example. The value "*" means that all possible types are acceptable. The type is used to determine which Output can be connected to this Input.
  • label (optional) - short description (one word) of the Input
  • description (optional) - long user-friendly description of the Input
  • tags (optional) - add additional restrictions to connections between Inputs and Outputs. The input tags must be subset of the output tags to succeed the connection.
  • required (optional) - defines if the Input is required or optional. The default value is false.
  • reference (optional) - refers to the input of parent module type or null. If this input is part of the system module the reference should be null.
  • default value (optional) - the string representation of the default value of the Input. It must be compatible with the type of the Input
Author:
Yordan Mihaylov - Initial contribution, Florian Hotze - Add null annotations
  • Constructor Details

    • Input

      protected Input()
      Default constructor for deserialization e.g. by Gson.
    • Input

      public Input(String name, String type)
      Creates an Input instance base on type of accepted data and input name. These are required information and can't be null.
      Parameters:
      name - the unique name of the Input in scope of the module.
      type - the acceptable data type for this Input.
      Throws:
      IllegalArgumentException - If one of the name or type parameters is null.
    • Input

      public Input(String name, String type, @Nullable String label, @Nullable String description, @Nullable Set<String> tags, boolean required, @Nullable String reference, @Nullable String defaultValue)
      Creates an Input instance base on the specified parameters. Type of accepted data and input name are required information and can't be null.
      Parameters:
      name - unique name of the Input in scope of the module.
      type - the acceptable data type for this Input.
      label - a single word description of the Input.
      description - user-friendly description of the Input.
      tags - are associated with the Input. The tags add additional restrictions to connections between Inputs and Outputs. The input tags must be subset of the output tags to succeed the connection. For example: When we want to connect input to output and both have same java.lang.double data type. The output has assign "temperature" and "celsius" tags then the input must have at least one of these output's tags (i.e. "temperature") to connect this Input to the selected output.
      required - determines if the Input is required or optional.
      reference - refers to the input of parent module type or null. If this input is part of the system module the reference should be null.
      defaultValue - default value takes place when there is no value for this Input. Type of the default value must be the type the Input.
      Throws:
      IllegalArgumentException - If one of the name or type parameters is null.
  • Method Details

    • getName

      public String getName()
      Gets the name of Input. It must be unique in scope of the Rule.
      Returns:
      name is a unique identifier of the Input.
    • getLabel

      public @Nullable String getLabel()
      Gets the short description of the Input. Usually the label should be a single word description.
      Returns:
      label of the Input.
    • getDescription

      public @Nullable String getDescription()
      Gets the long description of the Input.
      Returns:
      user-friendly description of the Input.
    • isRequired

      public boolean isRequired()
      Determines if the Input is required or optional.
      Returns:
      true when required, false otherwise.
    • getType

      public String getType()
      Gets the type of the Input. The returned value can be any string that makes sense for the user, like a fully qualified name of a Java class, or a general description like "temperature", for example. The value "*" means that all possible types are acceptable.
      Returns:
      the type of the Input.
    • getTags

      public Set<String> getTags()
      Gets the tags of the Input. The tags add additional restrictions to connections between Inputs and Outputs. The input tags must be subset of the output tags to succeed the connection.
      For example: When we want to connect input to output and they both have same java.lang.double data type, and the output has assign "temperature" and "celsius" tags then the input must have at least one of these output's tags (i.e. "temperature") to connect this input to the selected output.
      Returns:
      tags associated with this Input.
    • getReference

      public @Nullable String getReference()
      Gets the reference to data source. It is used to link custom inputs (inputs of custom module type) to system input (defined by the system module type. The system module type uses only system inputs).
      Returns:
      reference to data source.
    • getDefaultValue

      public @Nullable String getDefaultValue()
      Gets the string representation of the default value of the Input. It is used when there is no runtime value for this Input. It must be compatible with the type of the Input.
      Returns:
      the string representation of the default value of this Input.
    • toString

      public String toString()
      Overrides:
      toString in class Object