Class Output

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

public class Output extends Object
This class defines meta-information properties, used by the Rule Engine when creating connections between modules. Outputs are the exit point of a Module. They are used as data source for Inputs of other Modules.

The meta-information contains:

  • name (mandatory) - unique ID in the scope of the Module
  • type (mandatory) - the type of the output data. 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 type is used to determine which Input can be connected to this Output
  • label (optional) - short id (one word) of the Output.
  • description (optional) - user friendly description of the Output
  • default value (optional) - the string representation of the default value of the Output.
  • reference (optional) - reference to data source. It defines what part of complex data (i.e. JavaBean, java.lang.Map etc.) has to be used as value of this output.

An Output can be connected to more than one Input with a compatible data type.

Author:
Yordan Mihaylov - Initial contribution, Ana Dimova - Initial contribution, Vasil Ilchev - Initial contribution
  • Constructor Details

    • Output

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

      public Output(String name, String type)
      Constructs an Output instance with the specified name and output data type.
      Parameters:
      name - a unique name of the Output.
      type - the type of the output data.
      Throws:
      IllegalArgumentException - If one of the name or type parameters is null.
    • Output

      public Output(String name, String type, String label, String description, Set<String> tags, String reference, String defaultValue)
      Constructs an Output instance with the specified parameters.
      Parameters:
      name - a unique name of the Output.
      type - the type of the output data.
      label - a single word description of the Output.
      description - is a user friendly description of the Output.
      tags - are associated with the Output. The tags add additional restrictions to connections between Inputs and Outputs. The Input's tags must be subset of the Output's 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 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.
      reference - refers to the data source. It defines what part of complex data should be used as source of this Output.
      defaultValue - takes place when there is no runtime value for this Output. Type of the default value must be the type of the Output.
      Throws:
      IllegalArgumentException - If one of the name or type parameters is null.
  • Method Details

    • getName

      public String getName()
      This method is used for getting the name of Output. It must be unique in scope of Rule.
      Returns:
      name is a unique identifier of the Output.
    • getType

      public String getType()
      This method is used to get the type of the Output. It 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.
      Returns:
      the type of the output data.
    • getLabel

      public String getLabel()
      This method is used for getting the short description of the Output. Usually the label should be a single word description.
      Returns:
      label of the Output.
    • getDescription

      public String getDescription()
      This method is used for getting the long description of the Output.
      Returns:
      user friendly description of the Output.
    • getReference

      public String getReference()
      This method is used for getting the reference to data source. It defines what part of complex data (i.e. JavaBean, java.lang.Map etc.) has to be used as a value of this Output. For example, in the Output data - java.lang.Map, the reference points to the property that has to be used as an output value.
      Returns:
      a reference to data source.
    • getTags

      public Set<String> getTags()
      This method is used for getting the tags of the Output. 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 data type - java.lang.double 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:
      the tags, associated with this Input.
    • getDefaultValue

      public String getDefaultValue()
      This method is used to get the string representation of the default value of the Output. It is used when there is no runtime value for this Output. It must be compatible with the type of the Output.
      Returns:
      the string representation of the default value of this Output.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: