@Override protected Object readInternal(Type resolvedType, Reader reader) throws Exception { return getGson().fromJson(reader, resolvedType); }
@Override protected void writeInternal(Object o, @Nullable Type type, Writer writer) throws Exception { // In Gson, toJson with a type argument will exclusively use that given type, // ignoring the actual type of the object... which might be more specific, // e.g. a subclass of the specified type which includes additional fields. // As a consequence, we're only passing in parameterized type declarations // which might contain extra generics that the object instance doesn't retain. if (type instanceof ParameterizedType) { getGson().toJson(o, type, writer); } else { getGson().toJson(o, writer); } }
@Override protected Object readInternal(Type resolvedType, Reader reader) throws Exception { return getGson().fromJson(reader, resolvedType); }
@Override protected void writeInternal(Object o, @Nullable Type type, Writer writer) throws Exception { // In Gson, toJson with a type argument will exclusively use that given type, // ignoring the actual type of the object... which might be more specific, // e.g. a subclass of the specified type which includes additional fields. // As a consequence, we're only passing in parameterized type declarations // which might contain extra generics that the object instance doesn't retain. if (type instanceof ParameterizedType) { getGson().toJson(o, type, writer); } else { getGson().toJson(o, writer); } }
@Override protected Object readInternal(Type resolvedType, Reader reader) throws Exception { return getGson().fromJson(reader, resolvedType); }
@Override protected Object readInternal(Type resolvedType, Reader reader) throws Exception { return getGson().fromJson(reader, resolvedType); }
@Override protected void writeInternal(Object o, @Nullable Type type, Writer writer) throws Exception { // In Gson, toJson with a type argument will exclusively use that given type, // ignoring the actual type of the object... which might be more specific, // e.g. a subclass of the specified type which includes additional fields. // As a consequence, we're only passing in parameterized type declarations // which might contain extra generics that the object instance doesn't retain. if (type instanceof ParameterizedType) { getGson().toJson(o, type, writer); } else { getGson().toJson(o, writer); } }
@Override protected void writeInternal(Object o, @Nullable Type type, Writer writer) throws Exception { // In Gson, toJson with a type argument will exclusively use that given type, // ignoring the actual type of the object... which might be more specific, // e.g. a subclass of the specified type which includes additional fields. // As a consequence, we're only passing in parameterized type declarations // which might contain extra generics that the object instance doesn't retain. if (type instanceof ParameterizedType) { getGson().toJson(o, type, writer); } else { getGson().toJson(o, writer); } }