Class JsonNodeService

java.lang.Object
tech.prodigio.core.libcoreservices.service.impl.JsonNodeService
All Implemented Interfaces:
IJsonNodeService

@Service public class JsonNodeService extends Object implements IJsonNodeService
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getAttributeAsDataType(com.fasterxml.jackson.databind.JsonNode data, String dataType)
    convert json node un object with data type specified Support for the following data types:
    * String
    * Boolean
    * boolean
    * Integer
    * int
    * Long
    * Double
    * Float
    * BigDecimal
    * LocalDate
    * LocalDateTime
    com.fasterxml.jackson.databind.JsonNode
    getJsonAttribute(com.fasterxml.jackson.databind.JsonNode jsonNode, String path)
    Find embedded jsonNode, can be used to find json objects in any depth level
    com.fasterxml.jackson.databind.JsonNode
    receives a String and converts it to a jsonNode
    mapAttributeFromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, String path, String dataType)
    Searches for the attribute specified in the path and returns it with the data type specified in dataType
    List<com.fasterxml.jackson.databind.JsonNode>
    mapAttributeFromJsonNodeAsList(com.fasterxml.jackson.databind.JsonNode jsonNode, String path)
    Searches for the attribute specified in the path and returns as JsonNode list it

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JsonNodeService

      public JsonNodeService()
  • Method Details

    • mapAttributeFromJsonNode

      public Object mapAttributeFromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, String path, String dataType)
      Description copied from interface: IJsonNodeService
      Searches for the attribute specified in the path and returns it with the data type specified in dataType

      > Support for the following data types:
      * String
      * Boolean
      * boolean
      * Integer
      * int
      * Long
      * Double
      * Float
      * BigDecimal
      * LocalDate
      * LocalDateTime

      Specified by:
      mapAttributeFromJsonNode in interface IJsonNodeService
      Parameters:
      jsonNode - jsonNode
      path - path to find attribute inside jsonNode
      dataType - data type of the attribute to be returned
      Returns:
      Object
    • getJsonNodeFromString

      public com.fasterxml.jackson.databind.JsonNode getJsonNodeFromString(String json)
      Description copied from interface: IJsonNodeService
      receives a String and converts it to a jsonNode
      Specified by:
      getJsonNodeFromString in interface IJsonNodeService
      Parameters:
      json - Json as string
      Returns:
      JsonNode
    • mapAttributeFromJsonNodeAsList

      public List<com.fasterxml.jackson.databind.JsonNode> mapAttributeFromJsonNodeAsList(com.fasterxml.jackson.databind.JsonNode jsonNode, String path)
      Searches for the attribute specified in the path and returns as JsonNode list it
      Specified by:
      mapAttributeFromJsonNodeAsList in interface IJsonNodeService
      Parameters:
      jsonNode - jsonNode
      path - path to find attribute inside jsonNode
      Returns:
      A list of JSON nodes
    • getAttributeAsDataType

      public Object getAttributeAsDataType(com.fasterxml.jackson.databind.JsonNode data, String dataType)
      Description copied from interface: IJsonNodeService
      convert json node un object with data type specified Support for the following data types:
      * String
      * Boolean
      * boolean
      * Integer
      * int
      * Long
      * Double
      * Float
      * BigDecimal
      * LocalDate
      * LocalDateTime
      Specified by:
      getAttributeAsDataType in interface IJsonNodeService
      Parameters:
      data - JsonNode Object
      dataType - data type of the attribute to be returned
      Returns:
      Object, if data type it not supported returns value as null
    • getJsonAttribute

      public com.fasterxml.jackson.databind.JsonNode getJsonAttribute(com.fasterxml.jackson.databind.JsonNode jsonNode, String path)
      Find embedded jsonNode, can be used to find json objects in any depth level
      Specified by:
      getJsonAttribute in interface IJsonNodeService
      Parameters:
      jsonNode - jsonNode
      path - path to find object
      Returns:
      JsonNode