public class GraphQLRequestSerializer
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
escapeJsonString(java.lang.String stringValue)
Encodes the value as a JSON string according to http://json.org/ rules
|
static java.lang.String |
getEntry(java.lang.Object input) |
static java.lang.String |
getEntry(java.lang.Object input,
boolean useObjectMapper)
Serialize object to a string
|
static java.lang.String |
objectMapperWriteValueAsString(java.lang.Object input) |
static java.lang.String |
serializeCollection(java.util.Collection<?> input,
boolean useObjectMapper) |
static java.lang.String |
serializeEnum(java.lang.Enum<?> input) |
static java.lang.String |
serializeMap(java.util.Map<?,?> input,
boolean useObjectMapper) |
static java.lang.String |
serializeMapEntry(java.util.Map.Entry<?,?> input,
boolean useObjectMapper) |
static java.lang.String |
toHttpJsonBody(GraphQLRequest graphQLRequest)
Serializes GraphQL request to be used as HTTP JSON body
according to https://graphql.org/learn/serving-over-http specifications
|
static java.lang.String |
toHttpJsonBody(GraphQLRequests graphQLRequests)
Serializes GraphQL requests to be used as HTTP JSON body
according to https://graphql.org/learn/serving-over-http specifications
|
static java.lang.String |
toQueryString(GraphQLRequest graphQLRequest)
Serializes GraphQL request as raw query string
|
public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
public static java.lang.String toHttpJsonBody(GraphQLRequests graphQLRequests)
graphQLRequests - GraphQL requests to serializepublic static java.lang.String toHttpJsonBody(GraphQLRequest graphQLRequest)
graphQLRequest - the GraphQL request to serializepublic static java.lang.String toQueryString(GraphQLRequest graphQLRequest)
graphQLRequest - the GraphQL request to serializepublic static java.lang.String getEntry(java.lang.Object input)
public static java.lang.String getEntry(java.lang.Object input,
boolean useObjectMapper)
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 toStringpublic static java.lang.String serializeCollection(java.util.Collection<?> input,
boolean useObjectMapper)
public static java.lang.String serializeMap(java.util.Map<?,?> input,
boolean useObjectMapper)
public static java.lang.String serializeMapEntry(java.util.Map.Entry<?,?> input,
boolean useObjectMapper)
public static java.lang.String serializeEnum(java.lang.Enum<?> input)
public static java.lang.String escapeJsonString(java.lang.String stringValue)
stringValue - the value to encode as a JSON stringpublic static java.lang.String objectMapperWriteValueAsString(java.lang.Object input)