@Test public void testReadFrom() throws IOException { Object obj = provider.readFrom((Class<Object>) MOCK.getClass(), MOCK.getClass(), new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE, MAP, IS); assertEquals(new Gson().fromJson(MOCK_OBJECT_JSON, MockObject.class), obj); }
@Override public Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(inputStream, Charset.forName(UTF_8))); Object obj = gson.fromJson(reader, type); reader.close(); return obj; }
GsonMessageBodyReaderWriter implements MessageBodyReader<Object>, MessageBodyWriter<Object> { @Override public Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(inputStream, Charset.forName(UTF_8))); Object obj = gson.fromJson(reader, type); reader.close(); return obj; } }
GsonMessageBodyReaderWriter implements MessageBodyReader<Object>, MessageBodyWriter<Object> { @Override public Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(inputStream, Charset.forName(UTF_8))); Object obj = gson.fromJson(reader, type); reader.close(); return obj; } GsonMessageBodyReaderWriter(); }
GsonMessageBodyReaderWriter implements MessageBodyReader<Object>, MessageBodyWriter<Object> { @Override public Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(inputStream, Charset.forName(UTF_8))); Object obj = gson.fromJson(reader, type); reader.close(); return obj; } GsonMessageBodyReaderWriter(); @Override boolean isReadable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream); @Override boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override long getSize(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream); }
GsonMessageBodyReaderWriter implements MessageBodyReader<Object>, MessageBodyWriter<Object> { @Override public Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(inputStream, Charset.forName(UTF_8))); Object obj = gson.fromJson(reader, type); reader.close(); return obj; } GsonMessageBodyReaderWriter(); @Override boolean isReadable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream); @Override boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override long getSize(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream);  }