Class GraphQLRequestSerializer
java.lang.Object
io.github.besi97.graphql.codegen.model.graphql.GraphQLRequestSerializer
Serializer of GraphQL request.
Provides ability to convert GraphQLRequest object to HTTP Json body, as well as to raw query string.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.fasterxml.jackson.databind.ObjectMapper -
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapeJsonString(String stringValue) Encodes the value as a JSON string according to http://json.org/ rulesstatic Stringstatic StringSerialize object to a stringstatic Stringstatic StringserializeCollection(Collection<?> input, boolean useObjectMapper) static StringserializeEnum(Enum<?> input) static StringserializeMap(Map<?, ?> input, boolean useObjectMapper) static StringserializeMapEntry(Map.Entry<?, ?> input, boolean useObjectMapper) static StringtoHttpJsonBody(GraphQLRequest graphQLRequest) Serializes GraphQL request to be used as HTTP JSON body according to https://graphql.org/learn/serving-over-http specificationsstatic StringtoHttpJsonBody(GraphQLRequests graphQLRequests) Serializes GraphQL requests to be used as HTTP JSON body according to https://graphql.org/learn/serving-over-http specificationsstatic StringtoQueryString(GraphQLRequest graphQLRequest) Serializes GraphQL request as raw query string
-
Field Details
-
OBJECT_MAPPER
public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
-
-
Method Details
-
toHttpJsonBody
Serializes GraphQL requests to be used as HTTP JSON body according to https://graphql.org/learn/serving-over-http specifications- Parameters:
graphQLRequests- GraphQL requests to serialize- Returns:
- the serialized request
-
toHttpJsonBody
Serializes GraphQL request to be used as HTTP JSON body according to https://graphql.org/learn/serving-over-http specifications- Parameters:
graphQLRequest- the GraphQL request to serialize- Returns:
- the serialized request
-
toQueryString
Serializes GraphQL request as raw query string- Parameters:
graphQLRequest- the GraphQL request to serialize- Returns:
- the serialized request
-
getEntry
-
getEntry
Serialize object to a string- Parameters:
input- can be any object or collection/map of objects.useObjectMapper- if true, then use Jackson's ObjectMapper to convert from object to string, otherwise use toString- Returns:
- serialized object
-
serializeCollection
-
serializeMap
-
serializeMapEntry
-
serializeEnum
-
escapeJsonString
Encodes the value as a JSON string according to http://json.org/ rules- Parameters:
stringValue- the value to encode as a JSON string- Returns:
- the encoded string
-
objectMapperWriteValueAsString
-