Class GraphQLObjectMapper
- java.lang.Object
-
- com.graphql_java_generator.client.GraphQLObjectMapper
-
public class GraphQLObjectMapper extends java.lang.ObjectThis class is a wrapper around anObjectMapper. It allows the GraphQL plugin generated code to use its ownObjectMapper, without interfering with the containing app. This insures that the containing app can configure and use "its"ObjectMapperas it wants, and that the GraphQL plugin can use its ownObjectMapperwith its own configuration.
This class is not Spring bean, as it is configured for each request, with the list of alias for this GraphQL request.- Author:
- etienne-sf
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classGraphQLObjectMapper.GraphQLDeserializationProblemHandlerThis class handles various deserialization problems.
-
Constructor Summary
Constructors Constructor Description GraphQLObjectMapper(java.lang.String graphQLObjectsPackage, java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.reflect.Field>> aliasFields)Standard creator for the GraphQLObjectMapper
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode>convertValue(com.fasterxml.jackson.databind.JsonNode extensions, com.fasterxml.jackson.core.type.TypeReference<java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode>> typeReference)<T> TconvertValue(java.lang.Object o, java.lang.Class<T> clazz)java.lang.ObjectgetAliasValue(com.fasterxml.jackson.core.JsonParser parser, java.lang.reflect.Field targetField, com.fasterxml.jackson.core.TreeNode value)Parse a TreeNode, and return it as a value, according to the given classescom.fasterxml.jackson.databind.JsonNodereadTree(java.lang.String content)<T> TreadValue(java.lang.String msg, java.lang.Class<T> subscriptionType)<T> TtreeToValue(com.fasterxml.jackson.core.TreeNode value, java.lang.Class<T> clazz)java.lang.StringwriteValueAsString(java.lang.Object o)
-
-
-
Constructor Detail
-
GraphQLObjectMapper
public GraphQLObjectMapper(java.lang.String graphQLObjectsPackage, java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.reflect.Field>> aliasFields)Standard creator for the GraphQLObjectMapper- Parameters:
graphQLObjectsPackage- The package where the GraphQL objects have been generated
-
-
Method Detail
-
getAliasValue
public java.lang.Object getAliasValue(com.fasterxml.jackson.core.JsonParser parser, java.lang.reflect.Field targetField, com.fasterxml.jackson.core.TreeNode value) throws java.io.IOException, GraphQLRequestExecutionExceptionParse a TreeNode, and return it as a value, according to the given classes- Parameters:
parser- The current json parsertargetField- The field on which an alias has been set. This allows to retrieve the annotation on this field, to know everything about it's properties, as defined in the GraphQL schema.
It may be null, in which case enumeration values won't be properly deserialized.value- The value to parse- Returns:
- The parsed value. That is, according to the above sample: a String, a List
or a List - >
- Throws:
java.io.IOExceptionGraphQLRequestExecutionException
-
convertValue
public java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> convertValue(com.fasterxml.jackson.databind.JsonNode extensions, com.fasterxml.jackson.core.type.TypeReference<java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode>> typeReference)
-
convertValue
public <T> T convertValue(java.lang.Object o, java.lang.Class<T> clazz)
-
readValue
public <T> T readValue(java.lang.String msg, java.lang.Class<T> subscriptionType) throws com.fasterxml.jackson.databind.JsonMappingException, com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
readTree
public com.fasterxml.jackson.databind.JsonNode readTree(java.lang.String content) throws com.fasterxml.jackson.databind.JsonMappingException, com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.databind.JsonMappingExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
treeToValue
public <T> T treeToValue(com.fasterxml.jackson.core.TreeNode value, java.lang.Class<T> clazz) throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
writeValueAsString
public java.lang.String writeValueAsString(java.lang.Object o) throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
-