Package org.openhab.core.automation.type
Class Input
java.lang.Object
org.openhab.core.automation.type.Input
This class defines meta-information properties, used by the Rule Engine when creating connections between
modules.
The
Input
s of a Module
are the entry points for data coming from other Module
s. 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 whichOutput
can be connected to thisInput
. - 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
Input
s andOutput
s. 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 theInput
- Author:
- Yordan Mihaylov - Initial contribution, Florian Hotze - Add null annotations
-
Constructor Summary
ModifierConstructorDescriptionprotected
Input()
Default constructor for deserialization e.g.Creates anInput
instance base on type of accepted data and input name.Input
(String name, String type, @Nullable String label, @Nullable String description, @Nullable Set<String> tags, boolean required, @Nullable String reference, @Nullable String defaultValue) Creates anInput
instance base on the specified parameters. -
Method Summary
Modifier and TypeMethodDescription@Nullable String
Gets the string representation of the default value of theInput
.@Nullable String
Gets the long description of the Input.@Nullable String
getLabel()
Gets the short description of the Input.getName()
Gets the name of Input.@Nullable String
Gets the reference to data source.getTags()
Gets the tags of the Input.getType()
Gets the type of theInput
.boolean
Determines if the Input is required or optional.toString()
-
Constructor Details
-
Input
protected Input()Default constructor for deserialization e.g. by Gson. -
Input
Creates anInput
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 theInput
in scope of the module.type
- the acceptable data type for thisInput
.- 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 anInput
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 theInput
in scope of the module.type
- the acceptable data type for thisInput
.label
- a single word description of theInput
.description
- user-friendly description of theInput
.tags
- are associated with theInput
. The tags add additional restrictions to connections betweenInput
s andOutput
s. 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 thisInput
to the selected output.required
- determines if theInput
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
Gets the name of Input. It must be unique in scope of theRule
.- Returns:
- name is a unique identifier of the Input.
-
getLabel
Gets the short description of the Input. Usually the label should be a single word description.- Returns:
- label of the Input.
-
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
Gets the type of theInput
. 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
Gets the tags of the Input. The tags add additional restrictions to connections betweenInput
s andOutput
s. 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
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
Gets the string representation of the default value of theInput
. It is used when there is no runtime value for thisInput
. It must be compatible with the type of theInput
.- Returns:
- the string representation of the default value of this
Input
.
-
toString
-