Class JsonProcessor
- java.lang.Object
-
- io.github.spartatech.sqljson.jsonprocessing.JsonProcessor
-
public class JsonProcessor extends Object
Processes the query against given Json and generates de results
-
-
Constructor Summary
Constructors Constructor Description JsonProcessor(com.fasterxml.jackson.databind.JsonNode json, JsonQueryClause query)Constructor receiving JSON and query.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<LinkedHashMap<String,com.fasterxml.jackson.databind.JsonNode>>narrowResultElements(List<com.fasterxml.jackson.databind.JsonNode> elements)Return the selected columns.JsonResultSetprocess()Main processor method.
-
-
-
Constructor Detail
-
JsonProcessor
public JsonProcessor(com.fasterxml.jackson.databind.JsonNode json, JsonQueryClause query)Constructor receiving JSON and query.- Parameters:
json- json to be queriedquery- SQL to be executed
-
-
Method Detail
-
process
public JsonResultSet process() throws Exception
Main processor method.- Returns:
- List of results found
- Throws:
Exception- in case of any failure
-
narrowResultElements
public List<LinkedHashMap<String,com.fasterxml.jackson.databind.JsonNode>> narrowResultElements(List<com.fasterxml.jackson.databind.JsonNode> elements) throws SQLSyntaxErrorException
Return the selected columns. Star will return all fields . (dot) will return a json- Parameters:
elements- all elements to filter columns- Returns:
- List rows, where rows are a map of cols
- Throws:
SQLSyntaxErrorException- in case selectors are invalid
-
-