Class JacksonJsonNode


  • public class JacksonJsonNode
    extends SpinJsonNode
    Wrapper for a Jackson Json Tree Node.
    Author:
    Thorben Lindhauer, Stefan Hentschel
    • Field Detail

      • jsonNode

        protected final com.fasterxml.jackson.databind.JsonNode jsonNode
    • Constructor Detail

      • JacksonJsonNode

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

      • unwrap

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

        protected java.lang.Integer getCorrectIndex​(java.lang.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
      • lookupArray

        protected int lookupArray​(com.fasterxml.jackson.databind.JsonNode searchNode,
                                  int direction)
      • indexOf

        public java.lang.Integer indexOf​(java.lang.Object searchObject)
        Specified by:
        indexOf in class SpinJsonNode
      • lastIndexOf

        public java.lang.Integer lastIndexOf​(java.lang.Object searchObject)
        Specified by:
        lastIndexOf in class SpinJsonNode
      • contains

        public boolean contains​(java.lang.Object searchObject)
        Specified by:
        contains in class SpinJsonNode
      • hasProp

        public boolean hasProp​(java.lang.String name)
        Specified by:
        hasProp in class SpinJsonNode
      • prop

        public SpinJsonNode prop​(java.lang.String name,
                                 java.util.List<java.lang.Object> newProperty)
        Specified by:
        prop in class SpinJsonNode
      • propList

        public SpinJsonNode propList​(java.lang.String name,
                                     java.util.List<java.lang.Object> newProperty)
      • prop

        public SpinJsonNode prop​(java.lang.String name,
                                 java.util.Map<java.lang.String,​java.lang.Object> newProperty)
        Specified by:
        prop in class SpinJsonNode
      • value

        public java.lang.Object value()
        Specified by:
        value in class SpinJsonNode
      • fieldNames

        public java.util.List<java.lang.String> fieldNames()
        Specified by:
        fieldNames in class SpinJsonNode
      • getNodeType

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

        public <C> C mapTo​(java.lang.Class<C> type)
        Maps the json represented by this object to a java object of the given type.
        Note: the desired target type is not validated and needs to be trusted.
        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​(java.lang.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()).
        Note: the desired target type is not validated and needs to be trusted.
        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.
        Note: the desired target type is not validated and needs to be trusted.
        Throws:
        SpinJsonException - if the json representation cannot be mapped to the specified type