Class JxValue
- java.lang.Object
-
- com.inductiveautomation.perspective.designer.model.JxValue
-
public class JxValue extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description JxValue(java.lang.Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.Double>asDouble()If the value is aNumber, or is aStringvalue parsable as a number, will return an optional containing a Double representation of the value.java.util.Optional<java.lang.Integer>asInt()If the value is aNumber, or is aStringvalue parsable as a number, will return an optional containing an Integer representation of the value.java.util.Optional<com.teamdev.jxbrowser.js.JsObject>asJsObject()java.util.Optional<java.lang.Long>asLong()Get an Optional containing a Long if the value held is aLong, aNumber, or a String that is parseable to a Number.java.util.Optional<java.lang.String>asString()java.lang.ObjectgetRawValue()booleanisJsObject()booleanisNumber()booleanisString()com.inductiveautomation.ignition.common.gson.JsonElementtoJson()java.lang.StringtoString()
-
-
-
Method Detail
-
asJsObject
public java.util.Optional<com.teamdev.jxbrowser.js.JsObject> asJsObject()
- Returns:
- an optional containing the raw
JsObjectheld by this value, if and only if the original value was a JsObject, otherwise returnsOptional.empty()
-
asInt
public java.util.Optional<java.lang.Integer> asInt()
If the value is aNumber, or is aStringvalue parsable as a number, will return an optional containing an Integer representation of the value. Otherwise will return an empty optional.
-
asDouble
public java.util.Optional<java.lang.Double> asDouble()
If the value is aNumber, or is aStringvalue parsable as a number, will return an optional containing a Double representation of the value. Otherwise will return an empty optional.
-
asLong
public java.util.Optional<java.lang.Long> asLong()
Get an Optional containing a Long if the value held is aLong, aNumber, or a String that is parseable to a Number. Otherwise returns an empty Optional.
-
asString
public java.util.Optional<java.lang.String> asString()
- Returns:
- Optional containing
Stringif 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()
-
getRawValue
@Nullable public java.lang.Object getRawValue()
- Returns:
- the raw value contained. May be null if originating JxBrowser value was null or undefined.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-