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
Fields Modifier and Type Field Description protected com.fasterxml.jackson.databind.JsonNodejsonNode
-
Constructor Summary
Constructors Constructor Description ScriptingJsonObject(com.fasterxml.jackson.databind.JsonNode jsonNode)
-
Method Summary
-
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
-
-
-
-
Method Detail
-
createChildObject
public ScriptingJsonObject createChildObject(String fieldName)
- Specified by:
createChildObjectin interfaceScriptingJsonNode
-
createChildArray
public ScriptingJsonObject createChildArray(String fieldName)
- Specified by:
createChildArrayin interfaceScriptingJsonNode
-
putString
public ScriptingJsonObject putString(String fieldName, String value)
- Specified by:
putStringin interfaceScriptingJsonNode
-
putInteger
public ScriptingJsonObject putInteger(String fieldName, Number value)
- Specified by:
putIntegerin interfaceScriptingJsonNode
-
putInt
public ScriptingJsonObject putInt(String fieldName, int value)
- Specified by:
putIntin interfaceScriptingJsonNode
-
putBoolean
public ScriptingJsonObject putBoolean(String fieldName, Boolean value)
- Specified by:
putBooleanin interfaceScriptingJsonNode
-
putShort
public ScriptingJsonObject putShort(String fieldName, Number value)
- Specified by:
putShortin interfaceScriptingJsonNode
-
putShort
public ScriptingJsonObject putShort(String fieldName, short value)
- Specified by:
putShortin interfaceScriptingJsonNode
-
putLong
public ScriptingJsonObject putLong(String fieldName, Number value)
- Specified by:
putLongin interfaceScriptingJsonNode
-
putLong
public ScriptingJsonObject putLong(String fieldName, long value)
- Specified by:
putLongin interfaceScriptingJsonNode
-
putDouble
public ScriptingJsonObject putDouble(String fieldName, Number value)
- Specified by:
putDoublein interfaceScriptingJsonNode
-
putDouble
public ScriptingJsonObject putDouble(String fieldName, double value)
- Specified by:
putDoublein interfaceScriptingJsonNode
-
putFloat
public ScriptingJsonObject putFloat(String fieldName, Number value)
- Specified by:
putFloatin interfaceScriptingJsonNode
-
putFloat
public ScriptingJsonObject putFloat(String fieldName, float value)
- Specified by:
putFloatin interfaceScriptingJsonNode
-
putObject
public ScriptingJsonObject putObject(String fieldName, Object value)
- Specified by:
putObjectin interfaceScriptingJsonNode
-
putNull
public ScriptingJsonObject putNull(String fieldName)
- Specified by:
putNullin interfaceScriptingJsonNode
-
addString
public ScriptingJsonObject addString(String value)
- Specified by:
addStringin interfaceScriptingJsonNode
-
addInteger
public ScriptingJsonObject addInteger(Number value)
- Specified by:
addIntegerin interfaceScriptingJsonNode
-
addInt
public ScriptingJsonObject addInt(int value)
- Specified by:
addIntin interfaceScriptingJsonNode
-
addBoolean
public ScriptingJsonObject addBoolean(Boolean value)
- Specified by:
addBooleanin interfaceScriptingJsonNode
-
addShort
public ScriptingJsonObject addShort(Number value)
- Specified by:
addShortin interfaceScriptingJsonNode
-
addShort
public ScriptingJsonObject addShort(short value)
- Specified by:
addShortin interfaceScriptingJsonNode
-
addLong
public ScriptingJsonObject addLong(Number value)
- Specified by:
addLongin interfaceScriptingJsonNode
-
addLong
public ScriptingJsonObject addLong(long value)
- Specified by:
addLongin interfaceScriptingJsonNode
-
addDouble
public ScriptingJsonObject addDouble(Number value)
- Specified by:
addDoublein interfaceScriptingJsonNode
-
addDouble
public ScriptingJsonObject addDouble(double value)
- Specified by:
addDoublein interfaceScriptingJsonNode
-
addFloat
public ScriptingJsonObject addFloat(Number value)
- Specified by:
addFloatin interfaceScriptingJsonNode
-
addFloat
public ScriptingJsonObject addFloat(float value)
- Specified by:
addFloatin interfaceScriptingJsonNode
-
addObject
public ScriptingJsonObject addObject(Object value)
- Specified by:
addObjectin interfaceScriptingJsonNode
-
addNull
public ScriptingJsonObject addNull()
- Specified by:
addNullin interfaceScriptingJsonNode
-
path
public ScriptingJsonObject path(String path)
- Specified by:
pathin interfaceScriptingJsonNode
-
path
public ScriptingJsonObject path(int index)
- Specified by:
pathin interfaceScriptingJsonNode
-
size
public int size()
- Specified by:
sizein interfaceScriptingJsonNode- Returns:
- the number of elements for this json node (array length for array nodes or number of attributes for object nodes).
-
asInteger
public Integer asInteger()
- Specified by:
asIntegerin 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
public Long asLong()
- Specified by:
asLongin interfaceScriptingJsonNode- Returns:
- this number value as long.
- Throws:
FlowableException- when this node is empty or null or not a number.
-
asBoolean
public Boolean asBoolean()
- Specified by:
asBooleanin interfaceScriptingJsonNode- Returns:
- this value as boolean.
- Throws:
FlowableException- when this node is empty or null or not a boolean.
-
asDouble
public Double asDouble()
- Specified by:
asDoublein interfaceScriptingJsonNode- Returns:
- this number value as double.
- Throws:
FlowableException- when this node is empty or null or not a number.
-
asString
public String asString()
- Specified by:
asStringin 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
public Iterator<ScriptingJsonNode> iterator()
- Specified by:
iteratorin 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
public Collection<String> fieldNames()
- Specified by:
fieldNamesin interfaceScriptingJsonNode- Returns:
- collection of field names for object nodes. Empty collection for non-object nodes.
-
isValue
public boolean isValue()
- Specified by:
isValuein interfaceScriptingJsonNode- Returns:
- true if this json node is a value node.
-
isArray
public boolean isArray()
- Specified by:
isArrayin interfaceScriptingJsonNode- Returns:
- true if this json node is an array node.
-
isObject
public boolean isObject()
- Specified by:
isObjectin interfaceScriptingJsonNode- Returns:
- true if this json node is an object node.
-
isString
public boolean isString()
- Specified by:
isStringin interfaceScriptingJsonNode- Returns:
- true if this json node is a string
-
isNumber
public boolean isNumber()
- Specified by:
isNumberin interfaceScriptingJsonNode- Returns:
- true if this json node is a number
-
isBoolean
public boolean isBoolean()
- Specified by:
isBooleanin interfaceScriptingJsonNode- Returns:
- true if this json node is a boolean
-
isNonNull
public boolean isNonNull()
- Specified by:
isNonNullin interfaceScriptingJsonNode
-
isPresent
public boolean isPresent()
- Specified by:
isPresentin interfaceScriptingJsonNode
-
checkForNull
protected void checkForNull(String action)
-
checkIsObjectNode
protected com.fasterxml.jackson.databind.node.ObjectNode checkIsObjectNode(String action)
-
checkIsArrayNode
protected com.fasterxml.jackson.databind.node.ArrayNode checkIsArrayNode(String action)
-
get
public com.fasterxml.jackson.databind.JsonNode get()
-
getJsonNode
public com.fasterxml.jackson.databind.JsonNode getJsonNode()
-
toString
public String 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)
-
-