List of usage examples for com.fasterxml.jackson.jaxrs.base ProviderBase isWriteable
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
From source file:com.github.parisoft.resty.utils.JacksonUtils.java
public static String write(Object object, MediaType contentType) throws IOException { for (ProviderBase<?, ?, ?, ?> provider : DataProcessors.getInstance().values()) { if (provider.isWriteable(object.getClass(), null, null, contentType)) { return provider.locateMapper(object.getClass(), contentType).writeValueAsString(object); }//www .j a v a 2 s. c o m } throw new IOException(String.format("no processors found for class=%s and Content-Type=%s", object.getClass(), contentType)); }