Enum OnOffType

    • Method Detail

      • values

        public static OnOffType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (OnOffType c : OnOffType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static OnOffType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • from

        public static OnOffType from​(String state)
        Converts a String value "ON" or "1" to ON or else to OFF.
        Parameters:
        state - String to convert to OnOffType
        Returns:
        returns the ON or OFF state based on the String
      • from

        public static OnOffType from​(boolean state)
        Parameters:
        state - boolean to convert to OnOffType
        Returns:
        returns the ON or OFF state based on the boolean
      • format

        public String format​(String pattern)
        Description copied from interface: Type
        Formats the value of this type according to a pattern (see Formatter).
        Specified by:
        format in interface Type
        Parameters:
        pattern - the pattern to use
        Returns:
        the formatted string
      • toFullString

        public String toFullString()
        Description copied from interface: Type
        Get a string representation that contains the whole internal representation of the type.

        The returned string could be consumed by the static 'valueOf(String)' method of the respective type to build a new type that is equal to this type.

        Specified by:
        toFullString in interface Type
        Returns:
        a full string representation of the type to be consumed by 'valueOf(String)'
      • as

        public <T extends State> @Nullable T as​(@Nullable Class<T> target)
        Description copied from interface: State
        Convert this State's value into another type
        Specified by:
        as in interface State
        Parameters:
        target - the desired State type
        Returns:
        the State's value in the given type's representation, or null if the conversion was not possible