Class JsonNodeService
java.lang.Object
tech.prodigio.core.libcoreservices.service.impl.JsonNodeService
- All Implemented Interfaces:
IJsonNodeService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttributeAsDataType(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
* LocalDateTimecom.fasterxml.jackson.databind.JsonNodegetJsonAttribute(com.fasterxml.jackson.databind.JsonNode jsonNode, String path) Find embedded jsonNode, can be used to find json objects in any depth levelcom.fasterxml.jackson.databind.JsonNodegetJsonNodeFromString(String json) receives a String and converts it to a jsonNodemapAttributeFromJsonNode(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 dataTypeList<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
-
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:IJsonNodeServiceSearches 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:
mapAttributeFromJsonNodein interfaceIJsonNodeService- Parameters:
jsonNode- jsonNodepath- path to find attribute inside jsonNodedataType- data type of the attribute to be returned- Returns:
- Object
-
getJsonNodeFromString
Description copied from interface:IJsonNodeServicereceives a String and converts it to a jsonNode- Specified by:
getJsonNodeFromStringin interfaceIJsonNodeService- 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:
mapAttributeFromJsonNodeAsListin interfaceIJsonNodeService- Parameters:
jsonNode- jsonNodepath- path to find attribute inside jsonNode- Returns:
- A list of JSON nodes
-
getAttributeAsDataType
Description copied from interface:IJsonNodeServiceconvert 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:
getAttributeAsDataTypein interfaceIJsonNodeService- Parameters:
data- JsonNode ObjectdataType- 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:
getJsonAttributein interfaceIJsonNodeService- Parameters:
jsonNode- jsonNodepath- path to find object- Returns:
- JsonNode
-