test_class.declarator: jsonEntityProvider
test_class.modifier: private
test_class.original_string: private JsonEntityProvider jsonEntityProvider;
test_class.type: JsonEntityProvider
test_class.var_name: jsonEntityProvider
test_class.file: everrest-core/src/test/java/org/everrest/core/impl/provider/JsonEntityProviderTest.java
test_class.identifier: JsonEntityProviderTest
test_case.body: @Test
      public void readsContentOfEntityStreamAsJsonValue() throws Exception {
          String content = "{\"title\": \"JUnit in Action\", \"pages\": 386, \"isdn\": 93011099534534, \"price\": 19.37, \"author\": \"Vincent Massol\"}";
          JsonValue result = (JsonValue)jsonEntityProvider.readFrom(JsonValue.class, null, null, APPLICATION_JSON_TYPE, new MultivaluedMapImpl(),
                                                                    new ByteArrayInputStream(content.getBytes()));
          assertEquals("Vincent Massol", result.getElement("author").getStringValue());
          assertEquals("JUnit in Action", result.getElement("title").getStringValue());
          assertEquals(386, result.getElement("pages").getIntValue());
          assertEquals(19.37, result.getElement("price").getNumberValue());
          assertEquals(93011099534534L, result.getElement("isdn").getLongValue());
      }
test_case.class_method_signature: JsonEntityProviderTest.readsContentOfEntityStreamAsJsonValue()
test_case.full_signature: @Test public void readsContentOfEntityStreamAsJsonValue()
test_case.identifier: readsContentOfEntityStreamAsJsonValue
test_case.invocations: readFrom getBytes assertEquals getStringValue getElement assertEquals getStringValue getElement assertEquals getIntValue getElement assertEquals getNumberValue getElement assertEquals getLongValue getElement
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void readsContentOfEntityStreamAsJsonValue()
focal_class.declarator: LOG = LoggerFactory.getLogger(JsonEntityProvider.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(JsonEntityProvider.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: IGNORED = new Class<?>[]{byte[].class, char[].class, DataSource.class,
                                                               DOMSource.class, File.class, InputStream.class, OutputStream.class,
                                                               JAXBElement.class, MultivaluedMap.class,
                                                               Reader.class, Writer.class, SAXSource.class, StreamingOutput.class,
                                                               StreamSource.class, String.class}
focal_class.modifier: private static final
focal_class.original_string: private static final Class<?>[] IGNORED = new Class<?>[]{byte[].class, char[].class, DataSource.class,
                                                               DOMSource.class, File.class, InputStream.class, OutputStream.class,
                                                               JAXBElement.class, MultivaluedMap.class,
                                                               Reader.class, Writer.class, SAXSource.class, StreamingOutput.class,
                                                               StreamSource.class, String.class};
focal_class.type: Class<?>[]
focal_class.var_name: IGNORED
focal_class.file: everrest-core/src/main/java/org/everrest/core/impl/provider/JsonEntityProvider.java
focal_class.identifier: JsonEntityProvider
focal_class.interfaces: implements EntityProvider<T>
focal_class.class_method_signature: JsonEntityProvider.isSupported(Class<?> type)
focal_class.full_signature: private static boolean isSupported(Class<?> type)
focal_class.identifier: isSupported
focal_class.modifiers: private static
focal_class.parameters: (Class<?> type)
focal_class.return: boolean
focal_class.signature: boolean isSupported(Class<?> type)
focal_class.class_method_signature: JsonEntityProvider.isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.full_signature: @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.identifier: isReadable
focal_class.modifiers: @Override public
focal_class.parameters: (Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.return: boolean
focal_class.signature: boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.class_method_signature: JsonEntityProvider.readFrom(Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)
focal_class.full_signature: @SuppressWarnings({"unchecked"}) @Override public T readFrom(Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)
focal_class.identifier: readFrom
focal_class.modifiers: @SuppressWarnings({"unchecked"}) @Override public
focal_class.parameters: (Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)
focal_class.return: T
focal_class.signature: T readFrom(Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)
focal_class.class_method_signature: JsonEntityProvider.getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.full_signature: @Override public long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.identifier: getSize
focal_class.modifiers: @Override public
focal_class.parameters: (T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.return: long
focal_class.signature: long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.class_method_signature: JsonEntityProvider.isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.full_signature: @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.identifier: isWriteable
focal_class.modifiers: @Override public
focal_class.parameters: (Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.return: boolean
focal_class.signature: boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.class_method_signature: JsonEntityProvider.writeTo(T t,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.full_signature: @SuppressWarnings("unchecked") @Override public void writeTo(T t,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.identifier: writeTo
focal_class.modifiers: @SuppressWarnings("unchecked") @Override public
focal_class.parameters: (T t,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.return: void
focal_class.signature: void writeTo(T t,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_method.body: @SuppressWarnings({"unchecked"})
      @Override
      public T readFrom(Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream) throws IOException {
          try {
              JsonParser jsonParser = new JsonParser();
              jsonParser.parse(entityStream);
              JsonValue jsonValue = jsonParser.getJsonObject();
  
              if (JsonValue.class.isAssignableFrom(type)) {
                  return (T)jsonValue;
              }
  
              Types jsonType = JsonUtils.getType(type);
              if (jsonType == Types.ARRAY_BOOLEAN || jsonType == Types.ARRAY_BYTE || jsonType == Types.ARRAY_SHORT
                  || jsonType == Types.ARRAY_INT || jsonType == Types.ARRAY_LONG || jsonType == Types.ARRAY_FLOAT
                  || jsonType == Types.ARRAY_DOUBLE || jsonType == Types.ARRAY_CHAR || jsonType == Types.ARRAY_STRING
                  || jsonType == Types.ARRAY_OBJECT) {
                  return (T)ObjectBuilder.createArray(type, jsonValue);
              }
              if (jsonType == Types.COLLECTION) {
                  return (T)ObjectBuilder.createCollection((Class)type, genericType, jsonValue);
              }
              if (jsonType == Types.MAP) {
                  return (T)ObjectBuilder.createObject((Class)type, genericType, jsonValue);
              }
              return ObjectBuilder.createObject(type, jsonValue);
          } catch (JsonException e) {
              LOG.debug(e.getMessage(), e);
              throw new IOException(String.format("Can't read from input stream %s", e), e);
          }
      }
focal_method.class_method_signature: JsonEntityProvider.readFrom(Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)
focal_method.full_signature: @SuppressWarnings({"unchecked"}) @Override public T readFrom(Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)
focal_method.identifier: readFrom
focal_method.invocations: parse getJsonObject isAssignableFrom getType createArray createCollection createObject createObject debug getMessage format
focal_method.modifiers: @SuppressWarnings({"unchecked"}) @Override public
focal_method.parameters: (Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)
focal_method.return: T
focal_method.signature: T readFrom(Class<T> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, String> httpHeaders,
                        InputStream entityStream)