Class Semantics

java.lang.Object
org.openhab.core.model.script.actions.Semantics

@NonNullByDefault public class Semantics extends Object
The static methods of this class are made available as functions in the scripts. This allows a script to use Semantics features.
Author:
Christoph Weitkamp - Initial contribution
  • Constructor Details

    • Semantics

      public Semantics()
  • Method Details

    • isLocation

      public static boolean isLocation(Item item)
      Checks if the given Item is a Location.
      Parameters:
      item - the Item to check
      Returns:
      return true, if the given Item is a Location, false otherwise
    • isEquipment

      public static boolean isEquipment(Item item)
      Checks if the given Item is an Equipment.
      Parameters:
      item - the Item to check
      Returns:
      return true, if the given Item is an Equipment, false otherwise
    • isPoint

      public static boolean isPoint(Item item)
      Checks if the given Item is a Point.
      Parameters:
      item - the Item to check
      Returns:
      return true, if the given Item is a Point, false otherwise
    • getLocation

      public static @Nullable Item getLocation(Item item)
      Gets the related Location Item of an Item.
      Parameters:
      item - the Item to determine the Location for
      Returns:
      the related Location Item of the Item or null
    • getLocationType

      public static @Nullable Class<? extends Location> getLocationType(Item item)
      Gets the related Location type of an Item.
      Parameters:
      item - the Item to determine the Location for
      Returns:
      the related Location type of the Item or null
    • getEquipment

      public static @Nullable Item getEquipment(Item item)
      Gets the related Equipment Item an Item belongs to.
      Parameters:
      item - the Item to retrieve the Equipment Item for
      Returns:
      the related Equipment Item the Item belongs to or null
    • getEquipmentType

      public static @Nullable Class<? extends Equipment> getEquipmentType(Item item)
      Gets the Equipment type an Item relates to.
      Parameters:
      item - the Item to retrieve the Equipment for
      Returns:
      the Equipment the Item relates to or null
    • getPointType

      public static @Nullable Class<? extends Point> getPointType(Item item)
      Gets the Point type an Item.
      Parameters:
      item - the Item to determine the Point for
      Returns:
      the Point type of the Item or null
    • getPropertyType

      public static @Nullable Class<? extends Property> getPropertyType(Item item)
      Gets the Property type an Item relates to.
      Parameters:
      item - the Item to retrieve the Property for
      Returns:
      the Property type the Item relates to or null
    • getSemanticType

      public static @Nullable Class<? extends Tag> getSemanticType(Item item)
      Determines the semantic type of an Item (i.e. a sub-type of Location, Equipment or Point).
      Parameters:
      item - the Item to get the semantic type for
      Returns:
      a sub-type of Location, Equipment or Point