Class GsonValueMapper
- java.lang.Object
-
- io.leangen.graphql.metadata.strategy.value.gson.GsonValueMapper
-
- All Implemented Interfaces:
InputFieldBuilder,ValueMapper
public class GsonValueMapper extends Object implements ValueMapper, InputFieldBuilder
-
-
Field Summary
-
Fields inherited from interface io.leangen.graphql.metadata.strategy.value.ValueMapper
TYPE_METADATA_FIELD_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DefaultValuedefaultValue(List<AnnotatedElement> members, AnnotatedType fieldType, GlobalEnvironment environment)<T> TfromInput(Object graphQLInput, Type sourceType, AnnotatedType outputType)<T> TfromString(String json, AnnotatedType type)protected StringgetDescription(List<AnnotatedElement> members, MessageBundle messageBundle)Set<InputField>getInputFields(InputFieldBuilderParams params)Unlike Jackson, Gson doesn't expose any of its metadata, so this method is more or less a reimplementation ofcom.google.gson.internal.bind.ReflectiveTypeAdapterFactory#getBoundFields(Gson, com.google.gson.reflect.TypeToken, Class)TypeDiscriminatorFieldgetTypeDiscriminatorField(InputFieldBuilderParams params)protected TypedElementreduce(AnnotatedType declaringType, Field field, TypeTransformer transformer)protected TypedElementreduce(AnnotatedType declaringType, Method getter, TypeTransformer transformer)booleansupports(AnnotatedType type)StringtoString(Object output, AnnotatedType type)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.leangen.graphql.metadata.strategy.value.ValueMapper
fromInput
-
-
-
-
Method Detail
-
fromInput
public <T> T fromInput(Object graphQLInput, Type sourceType, AnnotatedType outputType) throws InputParsingException
- Specified by:
fromInputin interfaceValueMapper- Throws:
InputParsingException
-
fromString
public <T> T fromString(String json, AnnotatedType type)
- Specified by:
fromStringin interfaceValueMapper
-
toString
public String toString(Object output, AnnotatedType type)
- Specified by:
toStringin interfaceValueMapper
-
getInputFields
public Set<InputField> getInputFields(InputFieldBuilderParams params)
Unlike Jackson, Gson doesn't expose any of its metadata, so this method is more or less a reimplementation ofcom.google.gson.internal.bind.ReflectiveTypeAdapterFactory#getBoundFields(Gson, com.google.gson.reflect.TypeToken, Class)- Specified by:
getInputFieldsin interfaceInputFieldBuilder- Parameters:
params- The parameters available to the discovery strategy- Returns:
- All deserializable fields that could be discovered from this
AnnotatedType
-
getTypeDiscriminatorField
public TypeDiscriminatorField getTypeDiscriminatorField(InputFieldBuilderParams params)
- Specified by:
getTypeDiscriminatorFieldin interfaceInputFieldBuilder
-
reduce
protected TypedElement reduce(AnnotatedType declaringType, Field field, TypeTransformer transformer)
-
reduce
protected TypedElement reduce(AnnotatedType declaringType, Method getter, TypeTransformer transformer)
-
getDescription
protected String getDescription(List<AnnotatedElement> members, MessageBundle messageBundle)
-
defaultValue
protected DefaultValue defaultValue(List<AnnotatedElement> members, AnnotatedType fieldType, GlobalEnvironment environment)
-
supports
public boolean supports(AnnotatedType type)
- Specified by:
supportsin interfaceInputFieldBuilder
-
-