Package org.camunda.spin.json
Class SpinJsonNode
- Direct Known Subclasses:
- JacksonJsonNode
A json node.
- Author:
- Thorben Lindhauer, Stefan Hentschel
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract SpinJsonNodeAppends a object to the end of the current array nodeabstract BooleanGet this node as a boolean value.abstract booleanReturnstrueif the array contains the specified object.abstract SpinJsonNodedeleteProp(String name) Remove a property of the given node by name.abstract SpinJsonNodedeleteProp(List<String> names) Removes a number of properties by a given list of names.abstract SpinList<SpinJsonNode>elements()Get this node as list.Get the field names of this node (i.e.abstract booleanCheck if this node has a property with the given name.abstract IntegerFetches the first index of the searched object in an array.abstract SpinJsonNodeinsertAfter(Object searchObject, Object insertObject) Inserts an object AFTER an specific object in an arrayabstract SpinJsonNodeAppends an object at a specific point in an arrayabstract SpinJsonNodeinsertBefore(Object searchObject, Object insertObject) Inserts an object BEFORE an specific object in an arrayabstract BooleanisArray()Check if this node is a array value.abstract BooleanCheck if this node is a boolean value.abstract BooleanisNull()Check if this node represents a null value.abstract BooleanisNumber()Check if this node is a number value.abstract booleanisObject()Check if this node is an object node.abstract BooleanisString()Check if this node is a string value.abstract BooleanisValue()Check if this node is a value.abstract SpinJsonPathQueryCreates a JsonPath query on this element.abstract IntegerlastIndexOf(Object searchObject) Fetches the last index of the searched object in an array.abstract NumberGet this node as a number value.abstract SpinJsonNodeGet the property of this node with the given name.abstract SpinJsonNodeSet a new boolean property in this node.abstract SpinJsonNodeSet a new float property in this node.abstract SpinJsonNodeSet a new int property in this node.abstract SpinJsonNodeSet a new long property in this node.abstract SpinJsonNodeSet a new Boolean property in this node.abstract SpinJsonNodeSet a new Number property in this node.abstract SpinJsonNodeSet a new String property in this node.abstract SpinJsonNodeSet a new List property in this node.abstract SpinJsonNodeSet a new Map property in this node.abstract SpinJsonNodeprop(String name, SpinJsonNode newProperty) Set a new SpinJsonNode Object property in this node.abstract SpinJsonNodeRemoves the first appearance of an object from the current arrayabstract SpinJsonNoderemoveAt(int index) removes an object at the specific index of the current arrayabstract SpinJsonNoderemoveLast(Object property) Removes the last appearance of an object from the current arrayabstract StringGet this node as a string value.abstract Objectvalue()Gets the actual value of the node, in case it is a Boolean/String/Number/Null node.
- 
Constructor Details- 
SpinJsonNodepublic SpinJsonNode()
 
- 
- 
Method Details- 
indexOfFetches the first index of the searched object in an array.- Parameters:
- searchObject- Object for which the index should be searched.
- Returns:
- Integerindex of searchObject.
- Throws:
- SpinJsonException- if the current node is not an array.
- SpinJsonPropertyException- if object is not found.
 
- 
lastIndexOfFetches the last index of the searched object in an array.- Parameters:
- searchObject- Object for which the index should be searched.
- Returns:
- Integerindex of searchObject.
- Throws:
- SpinJsonException- if the current node is not an array.
- SpinJsonPropertyException- if object is not found.
 
- 
containsReturnstrueif the array contains the specified object.- Parameters:
- searchObject- Object for which the array should be searched.
- Returns:
- trueif the array contains the object.
- Throws:
- SpinJsonException- if the current node is not an array.
 
- 
isObjectpublic abstract boolean isObject()Check if this node is an object node.- Returns:
- true if the node is an object, false otherwise
 
- 
hasPropCheck if this node has a property with the given name.- Parameters:
- name- the name of the property
- Returns:
- true if this node has a property with this name, false otherwise
 
- 
propGet the property of this node with the given name.- Parameters:
- name- the name of the property
- Returns:
- SpinJsonNoderepresentation of the property
 
- 
propSet a new String property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new String property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new Number property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new Number property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new int property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new int property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new float property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new float property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new long property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new long property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new boolean property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new boolean property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new Boolean property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new Boolean property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new List property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new List property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new Map property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new Map property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
propSet a new SpinJsonNode Object property in this node.- Parameters:
- name- the name of the new property
- newProperty- the new SpinJsonNode Object property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
deletePropRemove a property of the given node by name.- Parameters:
- name- name of the property
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
deletePropRemoves a number of properties by a given list of names.- Parameters:
- names- list of names
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
appendAppends a object to the end of the current array node- Parameters:
- property- property which should be append
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
insertAtAppends an object at a specific point in an array- Parameters:
- index- Index in current node where the new property should be appended.
- property- Object which should be appended.
- Returns:
- SpinJsonNoderepresentation of the current node.
- Throws:
- IllegalArgumentException- if index is out of bound.
 
- 
insertBeforeInserts an object BEFORE an specific object in an array- Parameters:
- searchObject- Object which is searched
- insertObject- Object which will be inserted
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
insertAfterInserts an object AFTER an specific object in an array- Parameters:
- searchObject- Object which is searched
- insertObject- Object which will be inserted
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
removeRemoves the first appearance of an object from the current array- Parameters:
- property- object which should be deleted
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
removeLastRemoves the last appearance of an object from the current array- Parameters:
- property- object which should be deleted
- Returns:
- SpinJsonNoderepresentation of the current node
 
- 
removeAtremoves an object at the specific index of the current array- Parameters:
- index- Index of the array
- Returns:
- SpinJsonNoderepresentation of the current node
- Throws:
- IllegalArgumentException- if index is out of bound.
 
- 
isBooleanCheck if this node is a boolean value.- Returns:
- true if this node is a boolean value, false otherwise
 
- 
boolValueGet this node as a boolean value.- Returns:
- the boolean value of this node
- Throws:
- SpinDataFormatException- if this node is not a boolean value
 
- 
isNumberCheck if this node is a number value.- Returns:
- true if this node is a number value, false otherwise
 
- 
numberValueGet this node as a number value.- Returns:
- the number value of this node
- Throws:
- SpinDataFormatException- if this node is not a number value
 
- 
isStringCheck if this node is a string value.- Returns:
- true if this node is a string value, false otherwise
 
- 
stringValueGet this node as a string value.- Returns:
- the string value of this node
- Throws:
- SpinDataFormatException- if this node is not a string value
 
- 
isNullCheck if this node represents a null value.- Returns:
- true if this node is a null value, false otherwise
 
- 
isValueCheck if this node is a value.- Returns:
- true if this node is a value, false otherwise
 
- 
valueGets the actual value of the node, in case it is a Boolean/String/Number/Null node. In that case a Java Boolean/String/Number or null is returned.- Returns:
- the value of this node
- Throws:
- SpinDataFormatException- if this node is not a Boolean/String/Number/Nul value
 
- 
isArrayCheck if this node is a array value.- Returns:
- true if this node is a array value, false otherwise
 
- 
elementsGet this node as list. If the current node is an array, this method returns aSpinListwhich contains copies of all JSON nodes contained in the current node. Changes to the the elements in the list will not propagate to the original nodes.- Returns:
- the list value of this node
- Throws:
- SpinDataFormatException- if this node is not an array
 
- 
fieldNamesGet the field names of this node (i.e. the property names).- Returns:
- the list of field names
- Throws:
- SpinDataFormatException- if this node is not a array value
 
- 
jsonPathCreates a JsonPath query on this element.- Parameters:
- expression- the JsonPath expression
- Returns:
- the JsonPath query
 
 
-