Interface NodeValue
- All Known Implementing Classes:
NodeValue.Bot, NodeValue.Json, NodeValue.ValueList
Sealed interface representing a value that can be passed between script nodes.
Values are either JSON-serializable data or runtime bot references.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordRuntime bot reference (not JSON-serializable).static final recordJSON-serializable value (strings, numbers, booleans, arrays, objects, null).static final recordList of NodeValues that may contain non-JSON values (e.g., Bot references). -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanasBoolean(boolean defaultValue) Gets this value as a boolean, or returns the default if not a boolean.default @Nullable BotConnectionasBot()Gets this value as a BotConnection, or null if not a bot.default doubleasDouble(double defaultValue) Gets this value as a double, or returns the default if not a number.default intasInt(int defaultValue) Gets this value as an int, or returns the default if not a number.default @Nullable com.google.gson.JsonElementGets the raw JsonElement if this is a Json value.asList()Gets this value as a list of NodeValues.default longasLong(long defaultValue) Gets this value as a long, or returns the default if not a number.default StringGets this value as a string, or returns the default if not a string.Gets this value as a list of strings.static NodeValuefromJson(com.google.gson.JsonElement element) Creates a NodeValue from a JsonElement.default booleanisNull()Checks if this value is null.static NodeValueCreates a NodeValue from any object, converting to the appropriate type.static NodeValueofBoolean(boolean value) Creates a boolean NodeValue.static NodeValueofBot(BotConnection bot) Creates a bot NodeValue.static NodeValueCreates a list NodeValue.static NodeValueofNull()Creates a null NodeValue.static NodeValueCreates a number NodeValue.static NodeValueCreates a string NodeValue.
-
Method Details
-
of
-
ofNull
Creates a null NodeValue. -
ofString
-
ofNumber
-
ofBoolean
Creates a boolean NodeValue. -
ofList
-
ofBot
Creates a bot NodeValue. -
fromJson
Creates a NodeValue from a JsonElement. -
isNull
default boolean isNull()Checks if this value is null. -
asString
-
asDouble
default double asDouble(double defaultValue) Gets this value as a double, or returns the default if not a number. -
asInt
default int asInt(int defaultValue) Gets this value as an int, or returns the default if not a number. -
asLong
default long asLong(long defaultValue) Gets this value as a long, or returns the default if not a number. -
asBoolean
default boolean asBoolean(boolean defaultValue) Gets this value as a boolean, or returns the default if not a boolean. -
asList
-
asStringList
-
asBot
Gets this value as a BotConnection, or null if not a bot. -
asJsonElement
default @Nullable com.google.gson.JsonElement asJsonElement()Gets the raw JsonElement if this is a Json value.
-