T - the type being marshalled@PublicApi public class GsonMarshalling<T> extends BaseGsonMarshalling<T>
StringMarshalling to marshall the
String. Users are expected to provide a Gson implementation that is configured appropriately.| Constructor and Description |
|---|
GsonMarshalling(com.google.gson.Gson gson,
Class<T> targetClass)
Create a Marshaller using the supplied Gson for the specified class
|
GsonMarshalling(com.google.gson.Gson gson,
com.google.gson.reflect.TypeToken<T> typeToken)
Create a Marshaller using the supplied Gson for the specified class
|
| Modifier and Type | Method and Description |
|---|---|
static <T> com.atlassian.marshalling.api.MarshallingPair<T> |
pair(Class<T> targetClass)
Returns a
MarshallingPair for the given class using default configured Gson. |
static <T> com.atlassian.marshalling.api.MarshallingPair<T> |
pair(com.google.gson.Gson gson,
Class<T> targetClass)
Returns a
MarshallingPair for the given class using the supplied Gson. |
static <T> com.atlassian.marshalling.api.MarshallingPair<T> |
pair(com.google.gson.Gson gson,
com.google.gson.reflect.TypeToken<T> typeToken)
Returns a
MarshallingPair for the given class using the supplied Gson. |
static <T> com.atlassian.marshalling.api.MarshallingPair<T> |
pair(com.google.gson.reflect.TypeToken<T> typeToken)
Returns a
MarshallingPair for the given class using default configured Gson. |
getGson, getTypeToken, marshallToBytes, unmarshallFrompublic GsonMarshalling(com.google.gson.Gson gson,
Class<T> targetClass)
gson - The Gson instance to use for marshallingtargetClass - The class to marshallpublic GsonMarshalling(com.google.gson.Gson gson,
com.google.gson.reflect.TypeToken<T> typeToken)
gson - The Gson instance to use for marshallingtypeToken - The type token to use for the types we are marshallingpublic static <T> com.atlassian.marshalling.api.MarshallingPair<T> pair(com.google.gson.Gson gson,
Class<T> targetClass)
MarshallingPair for the given class using the supplied Gson.T - The type of the returned MarshallingPairgson - The Gson instance to use for marshalling/unmarshallingtargetClass - The type that will be marshalledpublic static <T> com.atlassian.marshalling.api.MarshallingPair<T> pair(com.google.gson.Gson gson,
com.google.gson.reflect.TypeToken<T> typeToken)
MarshallingPair for the given class using the supplied Gson.T - The type of the returned MarshallingPairgson - The Gson instance to use for marshalling/unmarshallingtypeToken - The type that will be marshalledpublic static <T> com.atlassian.marshalling.api.MarshallingPair<T> pair(com.google.gson.reflect.TypeToken<T> typeToken)
MarshallingPair for the given class using default configured Gson.T - The type of the returned MarshallingPairtypeToken - The type that will be marshalledpublic static <T> com.atlassian.marshalling.api.MarshallingPair<T> pair(Class<T> targetClass)
MarshallingPair for the given class using default configured Gson.T - The type of the returned MarshallingPairtargetClass - The type that will be marshalledCopyright © 2016 Atlassian. All rights reserved.