List of usage examples for com.fasterxml.jackson.jaxrs.base ProviderBase isReadable
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
From source file:com.github.parisoft.resty.utils.JacksonUtils.java
public static <T> T read(HttpEntity entity, Class<T> someClass, MediaType contentType) throws IOException { for (ProviderBase<?, ?, ?, ?> provider : DataProcessors.getInstance().values()) { if (provider.isReadable(someClass, null, null, contentType)) { return provider.locateMapper(someClass, contentType).readValue(entity.getContent(), someClass); }/*from www. j a v a 2 s . c om*/ } throw new IOException(String.format("no processors found for class=%s and Content-Type=%s", someClass.getName(), contentType)); }
From source file:com.github.parisoft.resty.utils.JacksonUtils.java
public static <T> T read(String content, Class<T> someClass, MediaType contentType) throws IOException { for (ProviderBase<?, ?, ?, ?> provider : DataProcessors.getInstance().values()) { if (provider.isReadable(someClass, null, null, contentType)) { return provider.locateMapper(someClass, contentType).readValue(content, someClass); }// w w w . j a v a 2s. com } throw new IOException(String.format("no processors found for class=%s and Content-Type=%s", someClass.getName(), contentType)); }
From source file:com.github.parisoft.resty.utils.JacksonUtils.java
public static <T> T read(String content, TypeReference<T> reference, MediaType contentType) throws IOException { for (ProviderBase<?, ?, ?, ?> provider : DataProcessors.getInstance().values()) { if (provider.isReadable(reference.getClass(), reference.getType(), null, contentType)) { return provider.locateMapper(reference.getClass(), contentType).readValue(content, reference); }/* w ww . j a v a2s .co m*/ } throw new IOException(String.format("no processors found for type=%s and Content-Type=%s", reference.getType(), contentType)); }
From source file:com.github.parisoft.resty.utils.JacksonUtils.java
public static <T> T read(HttpEntity entity, TypeReference<T> reference, MediaType contentType) throws IOException { for (ProviderBase<?, ?, ?, ?> provider : DataProcessors.getInstance().values()) { if (provider.isReadable(reference.getClass(), reference.getType(), null, contentType)) { return provider.locateMapper(reference.getClass(), contentType).readValue(entity.getContent(), reference);//from ww w . j a v a 2 s. co m } } throw new IOException(String.format("no processors found for type=%s and Content-Type=%s", reference.getType(), contentType)); }