java.lang.Object
java.lang.Record
com.inductiveautomation.perspective.designer.model.JxValue

public record JxValue(Object value) extends Record
  • Constructor Details

    • JxValue

      public JxValue(@Nullable Object value)
      Creates an instance of a JxValue record class.
      Parameters:
      value - the value for the value record component
  • Method Details

    • asJsObject

      public Optional<com.teamdev.jxbrowser.js.JsObject> asJsObject()
      Returns:
      an optional containing the raw JsObject held by this value, if and only if the original value was a JsObject, otherwise returns Optional.empty()
    • asInt

      public Optional<Integer> asInt()
      If the value is a Number, or is a String value parsable as a number, will return an optional containing an Integer representation of the value. Otherwise will return an empty optional.
    • asDouble

      public Optional<Double> asDouble()
      If the value is a Number, or is a String value parsable as a number, will return an optional containing a Double representation of the value. Otherwise will return an empty optional.
    • asLong

      public Optional<Long> asLong()
      Get an Optional containing a Long if the value held is a Long, a Number, or a String that is parseable to a Number. Otherwise returns an empty Optional.
    • asString

      public Optional<String> asString()
      Returns:
      Optional containing String if the javascript source value was a string literal or String.
    • isString

      public boolean isString()
      Returns:
      true if the held value is an instance of String
    • isNumber

      public boolean isNumber()
      Returns:
      true if the value is an instance of Number. Will not coerce or parse.
    • isJsObject

      public boolean isJsObject()
      Returns:
      true if the value held is a JsObject. If true, the originating value may be a javascript object literal, an instance of a javascript Object, or an array.
    • toJson

      public com.inductiveautomation.ignition.common.gson.JsonElement toJson()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      @Nullable public Object value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component