org.camunda.spin.impl.json.jackson
Class JacksonJsonNode

java.lang.Object
  extended by org.camunda.spin.Spin<SpinJsonNode>
      extended by org.camunda.spin.json.SpinJsonNode
          extended by org.camunda.spin.impl.json.jackson.JacksonJsonNode

public class JacksonJsonNode
extends SpinJsonNode

Wrapper for a Jackson Json Tree Node.

Author:
Thorben Lindhauer, Stefan Hentschel

Field Summary
protected  JacksonJsonDataFormat dataFormat
           
protected  com.fasterxml.jackson.databind.JsonNode jsonNode
           
 
Constructor Summary
JacksonJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, JacksonJsonDataFormat dataFormat)
           
 
Method Summary
 SpinJsonNode append(Object property)
           
 Boolean boolValue()
           
 SpinJsonNode deleteProp(List<String> names)
           
 SpinJsonNode deleteProp(String name)
           
 SpinList<SpinJsonNode> elements()
           
 List<String> fieldNames()
           
protected  Integer getCorrectIndex(Integer index)
          fetch correct array index if index is less than 0 ArrayNode will convert all negative integers into 0...
 String getDataFormatName()
           
 com.fasterxml.jackson.databind.node.JsonNodeType getNodeType()
           
 boolean hasProp(String name)
           
 Integer indexOf(Object searchObject)
           
 SpinJsonNode insertAfter(Object searchObject, Object insertObject)
           
 SpinJsonNode insertAt(int index, Object property)
           
 SpinJsonNode insertBefore(Object searchObject, Object insertObject)
           
 Boolean isArray()
           
 Boolean isBoolean()
           
 Boolean isNull()
           
 Boolean isNumber()
           
 boolean isObject()
           
 Boolean isString()
           
 Boolean isValue()
           
 SpinJsonPathQuery jsonPath(String expression)
           
 Integer lastIndexOf(Object searchObject)
           
<C> C
mapTo(Class<C> type)
          Maps the json represented by this object to a java object of the given type.
<C> C
mapTo(com.fasterxml.jackson.databind.JavaType type)
          Maps the json represented by this object to a java object of the given type.
<C> C
mapTo(String type)
          Maps the json represented by this object to a java object of the given type.
 Number numberValue()
           
 SpinJsonNode prop(String name)
           
 SpinJsonNode prop(String name, boolean newProperty)
           
 SpinJsonNode prop(String name, Boolean newProperty)
           
 SpinJsonNode prop(String name, float newProperty)
           
 SpinJsonNode prop(String name, int newProperty)
           
 SpinJsonNode prop(String name, List<Object> newProperty)
           
 SpinJsonNode prop(String name, long newProperty)
           
 SpinJsonNode prop(String name, Map<String,Object> newProperty)
           
 SpinJsonNode prop(String name, Number newProperty)
           
 SpinJsonNode prop(String name, SpinJsonNode newProperty)
           
 SpinJsonNode prop(String name, String newProperty)
           
 SpinJsonNode remove(Object property)
           
 SpinJsonNode removeAt(int index)
           
 SpinJsonNode removeLast(Object property)
           
 String stringValue()
           
 String toString()
           
 com.fasterxml.jackson.databind.JsonNode unwrap()
           
 Object value()
           
 void writeToWriter(Writer writer)
           
 
Methods inherited from class org.camunda.spin.Spin
JSON, S, S, S, XML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jsonNode

protected final com.fasterxml.jackson.databind.JsonNode jsonNode

dataFormat

protected final JacksonJsonDataFormat dataFormat
Constructor Detail

JacksonJsonNode

public JacksonJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode,
                       JacksonJsonDataFormat dataFormat)
Method Detail

getDataFormatName

public String getDataFormatName()
Specified by:
getDataFormatName in class Spin<SpinJsonNode>

unwrap

public com.fasterxml.jackson.databind.JsonNode unwrap()
Specified by:
unwrap in class Spin<SpinJsonNode>

toString

public String toString()
Specified by:
toString in class Spin<SpinJsonNode>

writeToWriter

public void writeToWriter(Writer writer)
Specified by:
writeToWriter in class Spin<SpinJsonNode>

getCorrectIndex

protected Integer getCorrectIndex(Integer index)
fetch correct array index if index is less than 0 ArrayNode will convert all negative integers into 0...

Parameters:
index - wanted index
Returns:
Integer new index

indexOf

public Integer indexOf(Object searchObject)
Specified by:
indexOf in class SpinJsonNode

lastIndexOf

public Integer lastIndexOf(Object searchObject)
Specified by:
lastIndexOf in class SpinJsonNode

isObject

public boolean isObject()
Specified by:
isObject in class SpinJsonNode

hasProp

public boolean hasProp(String name)
Specified by:
hasProp in class SpinJsonNode

prop

public SpinJsonNode prop(String name)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         String newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         Number newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         int newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         float newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         long newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         boolean newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         Boolean newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         List<Object> newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         Map<String,Object> newProperty)
Specified by:
prop in class SpinJsonNode

prop

public SpinJsonNode prop(String name,
                         SpinJsonNode newProperty)
Specified by:
prop in class SpinJsonNode

deleteProp

public SpinJsonNode deleteProp(String name)
Specified by:
deleteProp in class SpinJsonNode

deleteProp

public SpinJsonNode deleteProp(List<String> names)
Specified by:
deleteProp in class SpinJsonNode

append

public SpinJsonNode append(Object property)
Specified by:
append in class SpinJsonNode

insertAt

public SpinJsonNode insertAt(int index,
                             Object property)
Specified by:
insertAt in class SpinJsonNode

insertBefore

public SpinJsonNode insertBefore(Object searchObject,
                                 Object insertObject)
Specified by:
insertBefore in class SpinJsonNode

insertAfter

public SpinJsonNode insertAfter(Object searchObject,
                                Object insertObject)
Specified by:
insertAfter in class SpinJsonNode

remove

public SpinJsonNode remove(Object property)
Specified by:
remove in class SpinJsonNode

removeLast

public SpinJsonNode removeLast(Object property)
Specified by:
removeLast in class SpinJsonNode

removeAt

public SpinJsonNode removeAt(int index)
Specified by:
removeAt in class SpinJsonNode

isBoolean

public Boolean isBoolean()
Specified by:
isBoolean in class SpinJsonNode

boolValue

public Boolean boolValue()
Specified by:
boolValue in class SpinJsonNode

isNumber

public Boolean isNumber()
Specified by:
isNumber in class SpinJsonNode

numberValue

public Number numberValue()
Specified by:
numberValue in class SpinJsonNode

isString

public Boolean isString()
Specified by:
isString in class SpinJsonNode

stringValue

public String stringValue()
Specified by:
stringValue in class SpinJsonNode

isNull

public Boolean isNull()
Specified by:
isNull in class SpinJsonNode

isValue

public Boolean isValue()
Specified by:
isValue in class SpinJsonNode

value

public Object value()
Specified by:
value in class SpinJsonNode

isArray

public Boolean isArray()
Specified by:
isArray in class SpinJsonNode

elements

public SpinList<SpinJsonNode> elements()
Specified by:
elements in class SpinJsonNode

fieldNames

public List<String> fieldNames()
Specified by:
fieldNames in class SpinJsonNode

getNodeType

public com.fasterxml.jackson.databind.node.JsonNodeType getNodeType()

jsonPath

public SpinJsonPathQuery jsonPath(String expression)
Specified by:
jsonPath in class SpinJsonNode

mapTo

public <C> C mapTo(Class<C> type)
Maps the json represented by this object to a java object of the given type.

Specified by:
mapTo in class Spin<SpinJsonNode>
Throws:
SpinJsonException - if the json representation cannot be mapped to the specified type

mapTo

public <C> C mapTo(String type)
Maps the json represented by this object to a java object of the given type. Argument is to be supplied in Jackson's canonical type string format (see ResolvedType.toCanonical()).

Specified by:
mapTo in class Spin<SpinJsonNode>
Throws:
SpinJsonException - if the json representation cannot be mapped to the specified type
SpinJsonDataFormatException - if the parameter does not match a valid type

mapTo

public <C> C mapTo(com.fasterxml.jackson.databind.JavaType type)
Maps the json represented by this object to a java object of the given type.

Throws:
SpinJsonException - if the json representation cannot be mapped to the specified type


Copyright © 2016 camunda services GmbH. All rights reserved.