Class JacksonParser
java.lang.Object
io.github.qubitpi.athena.web.graphql.JacksonParser
- All Implemented Interfaces:
JsonDocumentParser
JacksonParser
parses GraphQL query using Jackson internally.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGiven the JSON document wrapping a GraphQL query string, this method extracts the query field and then the requested metadata field(s) in an ordered list.Given the JSON document wrapping a GraphQL query string, this method extracts the query argument, which is a file ID.static @NotNull JsonDocumentParser
Returns a fully initializedJsonDocumentParser
of this implementation.
-
Constructor Details
-
JacksonParser
public JacksonParser()
-
-
Method Details
-
getInstance
Returns a fully initializedJsonDocumentParser
of this implementation.- Returns:
- the same instance all the time
-
getFileId
Description copied from interface:JsonDocumentParser
Given the JSON document wrapping a GraphQL query string, this method extracts the query argument, which is a file ID.For example, if the document is
{ "query":"{\n metaData(fileId:\"2\") {\n fileName\nfileType }\n}" }
- Specified by:
getFileId
in interfaceJsonDocumentParser
- Parameters:
graphQLDocument
- The provided JSON document- Returns:
- an ordered list of requested metadata fields
-
getFields
Description copied from interface:JsonDocumentParser
Given the JSON document wrapping a GraphQL query string, this method extracts the query field and then the requested metadata field(s) in an ordered list.For example, if the document is
{ "query":"{\n metaData(fileId:\"2\") {\n fileName\nfileType }\n}", }
The order of the metadata fields also influences the element order in the returned list. For instance, if the document above changes to
{ "query":"{\n metaData(fileId:\"2\") {\n fileType\nfileName }\n}", }
If no fields are found, this method returns an
empty list
- Specified by:
getFields
in interfaceJsonDocumentParser
- Parameters:
graphQLDocument
- The provided JSON document which cannot benull
, otherwise the behavior of this method is undefined- Returns:
- an ordered list of requested metadata fields
-