Class ScriptingJsonObject
java.lang.Object
com.flowable.platform.engine.impl.scripting.ScriptingJsonObject
- All Implemented Interfaces:
ScriptingJsonNode
,Iterable<ScriptingJsonNode>
,Supplier<com.fasterxml.jackson.databind.JsonNode>
public class ScriptingJsonObject
extends Object
implements Supplier<com.fasterxml.jackson.databind.JsonNode>, ScriptingJsonNode
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddBoolean
(Boolean value) addDouble
(double value) addFloat
(float value) addInt
(int value) addInteger
(Number value) addLong
(long value) addNull()
addShort
(short value) asDouble()
asLong()
asString()
protected void
checkForNull
(String action) protected com.fasterxml.jackson.databind.node.ArrayNode
checkIsArrayNode
(String action) protected com.fasterxml.jackson.databind.node.ObjectNode
checkIsObjectNode
(String action) createChildArray
(String fieldName) createChildObject
(String fieldName) com.fasterxml.jackson.databind.JsonNode
get()
com.fasterxml.jackson.databind.JsonNode
boolean
isArray()
boolean
boolean
boolean
isNumber()
boolean
isObject()
boolean
boolean
isString()
boolean
isValue()
iterator()
path
(int index) putBoolean
(String fieldName, Boolean value) putInteger
(String fieldName, Number value) int
size()
toString()
Returns a toString representation of this ScriptingJsonObject.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
jsonNode
protected com.fasterxml.jackson.databind.JsonNode jsonNode
-
-
Constructor Details
-
ScriptingJsonObject
public ScriptingJsonObject(com.fasterxml.jackson.databind.JsonNode jsonNode)
-
-
Method Details
-
createChildObject
- Specified by:
createChildObject
in interfaceScriptingJsonNode
-
createChildArray
- Specified by:
createChildArray
in interfaceScriptingJsonNode
-
putString
- Specified by:
putString
in interfaceScriptingJsonNode
-
putInteger
- Specified by:
putInteger
in interfaceScriptingJsonNode
-
putInt
- Specified by:
putInt
in interfaceScriptingJsonNode
-
putBoolean
- Specified by:
putBoolean
in interfaceScriptingJsonNode
-
putShort
- Specified by:
putShort
in interfaceScriptingJsonNode
-
putShort
- Specified by:
putShort
in interfaceScriptingJsonNode
-
putLong
- Specified by:
putLong
in interfaceScriptingJsonNode
-
putLong
- Specified by:
putLong
in interfaceScriptingJsonNode
-
putDouble
- Specified by:
putDouble
in interfaceScriptingJsonNode
-
putDouble
- Specified by:
putDouble
in interfaceScriptingJsonNode
-
putFloat
- Specified by:
putFloat
in interfaceScriptingJsonNode
-
putFloat
- Specified by:
putFloat
in interfaceScriptingJsonNode
-
putObject
- Specified by:
putObject
in interfaceScriptingJsonNode
-
putNull
- Specified by:
putNull
in interfaceScriptingJsonNode
-
addString
- Specified by:
addString
in interfaceScriptingJsonNode
-
addInteger
- Specified by:
addInteger
in interfaceScriptingJsonNode
-
addInt
- Specified by:
addInt
in interfaceScriptingJsonNode
-
addBoolean
- Specified by:
addBoolean
in interfaceScriptingJsonNode
-
addShort
- Specified by:
addShort
in interfaceScriptingJsonNode
-
addShort
- Specified by:
addShort
in interfaceScriptingJsonNode
-
addLong
- Specified by:
addLong
in interfaceScriptingJsonNode
-
addLong
- Specified by:
addLong
in interfaceScriptingJsonNode
-
addDouble
- Specified by:
addDouble
in interfaceScriptingJsonNode
-
addDouble
- Specified by:
addDouble
in interfaceScriptingJsonNode
-
addFloat
- Specified by:
addFloat
in interfaceScriptingJsonNode
-
addFloat
- Specified by:
addFloat
in interfaceScriptingJsonNode
-
addObject
- Specified by:
addObject
in interfaceScriptingJsonNode
-
addNull
- Specified by:
addNull
in interfaceScriptingJsonNode
-
path
- Specified by:
path
in interfaceScriptingJsonNode
-
path
- Specified by:
path
in interfaceScriptingJsonNode
-
size
public int size()- Specified by:
size
in interfaceScriptingJsonNode
- Returns:
- the number of elements for this json node (array length for array nodes or number of attributes for object nodes).
-
asInteger
- Specified by:
asInteger
in interfaceScriptingJsonNode
- Returns:
- this value as integer in case it is a numeric value.
- Throws:
FlowableException
- when this node is empty or null, not a number or exceeds integer range.
-
asLong
- Specified by:
asLong
in interfaceScriptingJsonNode
- Returns:
- this number value as long.
- Throws:
FlowableException
- when this node is empty or null or not a number.
-
asBoolean
- Specified by:
asBoolean
in interfaceScriptingJsonNode
- Returns:
- this value as boolean.
- Throws:
FlowableException
- when this node is empty or null or not a boolean.
-
asDouble
- Specified by:
asDouble
in interfaceScriptingJsonNode
- Returns:
- this number value as double.
- Throws:
FlowableException
- when this node is empty or null or not a number.
-
asString
- Specified by:
asString
in interfaceScriptingJsonNode
- Returns:
- a string representation of this node, if this node is a value node (
isValue()
returns true). - Throws:
FlowableException
- when this node is not a value node.
-
iterator
- Specified by:
iterator
in interfaceIterable<ScriptingJsonNode>
- Returns:
- an iterator of this node. Wraps each object into a ScriptingJsonObject when this node is an array node. Otherwise, a single item iterator is returned.
-
fieldNames
- Specified by:
fieldNames
in interfaceScriptingJsonNode
- Returns:
- collection of field names for object nodes. Empty collection for non-object nodes.
-
isValue
public boolean isValue()- Specified by:
isValue
in interfaceScriptingJsonNode
- Returns:
- true if this json node is a value node.
-
isArray
public boolean isArray()- Specified by:
isArray
in interfaceScriptingJsonNode
- Returns:
- true if this json node is an array node.
-
isObject
public boolean isObject()- Specified by:
isObject
in interfaceScriptingJsonNode
- Returns:
- true if this json node is an object node.
-
isString
public boolean isString()- Specified by:
isString
in interfaceScriptingJsonNode
- Returns:
- true if this json node is a string
-
isNumber
public boolean isNumber()- Specified by:
isNumber
in interfaceScriptingJsonNode
- Returns:
- true if this json node is a number
-
isBoolean
public boolean isBoolean()- Specified by:
isBoolean
in interfaceScriptingJsonNode
- Returns:
- true if this json node is a boolean
-
isNonNull
public boolean isNonNull()- Specified by:
isNonNull
in interfaceScriptingJsonNode
-
isPresent
public boolean isPresent()- Specified by:
isPresent
in interfaceScriptingJsonNode
-
checkForNull
-
checkIsObjectNode
-
checkIsArrayNode
-
get
public com.fasterxml.jackson.databind.JsonNode get() -
getJsonNode
public com.fasterxml.jackson.databind.JsonNode getJsonNode() -
toString
Returns a toString representation of this ScriptingJsonObject.NOTE: Even though this method returns some json content, do not rely on it for parsing the content. Use a proper json generator to create a json string instead e.g.
ScriptingJsonUtils.jsonToString(ScriptingJsonNode)
-