2424import java .util .function .Supplier ;
2525import lombok .SneakyThrows ;
2626
27- /**
28- * @author Andrew Potter
29- */
27+ /** @author Andrew Potter */
3028public class GraphQLObjectMapper {
3129
32- private static final TypeReference <Map <String , List <String >>>
33- MULTIPART_MAP_TYPE_REFERENCE = new TypeReference <Map <String , List <String >>>() {
34- };
30+ private static final TypeReference <Map <String , List <String >>> MULTIPART_MAP_TYPE_REFERENCE =
31+ new TypeReference <Map <String , List <String >>>() {};
3532 private final ObjectMapperProvider objectMapperProvider ;
3633 private final Supplier <GraphQLErrorHandler > graphQLErrorHandlerSupplier ;
3734
3835 private ObjectMapper mapper ;
3936
40- protected GraphQLObjectMapper (ObjectMapperProvider objectMapperProvider ,
37+ protected GraphQLObjectMapper (
38+ ObjectMapperProvider objectMapperProvider ,
4139 Supplier <GraphQLErrorHandler > graphQLErrorHandlerSupplier ) {
4240 this .objectMapperProvider = objectMapperProvider ;
4341 this .graphQLErrorHandlerSupplier = graphQLErrorHandlerSupplier ;
@@ -62,9 +60,7 @@ public ObjectMapper getJacksonMapper() {
6260 return result ;
6361 }
6462
65- /**
66- * @return an {@link ObjectReader} for deserializing {@link GraphQLRequest}
67- */
63+ /** @return an {@link ObjectReader} for deserializing {@link GraphQLRequest} */
6864 public ObjectReader getGraphQLRequestMapper () {
6965 return getJacksonMapper ().reader ().forType (GraphQLRequest .class );
7066 }
@@ -102,8 +98,7 @@ public List<GraphQLRequest> readBatchedGraphQLRequest(String query) throws IOExc
10298
10399 @ SneakyThrows
104100 public String serializeResultAsJson (ExecutionResult executionResult ) {
105- return getJacksonMapper ()
106- .writeValueAsString (createResultFromExecutionResult (executionResult ));
101+ return getJacksonMapper ().writeValueAsString (createResultFromExecutionResult (executionResult ));
107102 }
108103
109104 public void serializeResultAsJson (Writer writer , ExecutionResult executionResult )
@@ -120,8 +115,7 @@ public void serializeResultAsJson(Writer writer, ExecutionResult executionResult
120115 */
121116 @ SneakyThrows
122117 public byte [] serializeResultAsBytes (ExecutionResult executionResult ) {
123- return getJacksonMapper ()
124- .writeValueAsBytes (createResultFromExecutionResult (executionResult ));
118+ return getJacksonMapper ().writeValueAsBytes (createResultFromExecutionResult (executionResult ));
125119 }
126120
127121 public boolean areErrorsPresent (ExecutionResult executionResult ) {
@@ -151,13 +145,16 @@ public Map<String, Object> convertSanitizedExecutionResult(ExecutionResult execu
151145 return convertSanitizedExecutionResult (executionResult , true );
152146 }
153147
154- public Map <String , Object > convertSanitizedExecutionResult (ExecutionResult executionResult ,
155- boolean includeData ) {
148+ public Map <String , Object > convertSanitizedExecutionResult (
149+ ExecutionResult executionResult , boolean includeData ) {
156150 final Map <String , Object > result = new LinkedHashMap <>();
157151
158152 if (areErrorsPresent (executionResult )) {
159- result .put ("errors" , executionResult .getErrors ().stream ().map (GraphQLError ::toSpecification )
160- .collect (toList ()));
153+ result .put (
154+ "errors" ,
155+ executionResult .getErrors ().stream ()
156+ .map (GraphQLError ::toSpecification )
157+ .collect (toList ()));
161158 }
162159
163160 if (executionResult .getExtensions () != null && !executionResult .getExtensions ().isEmpty ()) {
@@ -173,9 +170,8 @@ public Map<String, Object> convertSanitizedExecutionResult(ExecutionResult execu
173170
174171 @ SneakyThrows
175172 public Map <String , Object > deserializeVariables (String variables ) {
176- return VariablesDeserializer
177- .deserializeVariablesObject (getJacksonMapper ().readValue (variables , Object .class ),
178- getJacksonMapper ());
173+ return VariablesDeserializer .deserializeVariablesObject (
174+ getJacksonMapper ().readValue (variables , Object .class ), getJacksonMapper ());
179175 }
180176
181177 @ SneakyThrows
0 commit comments