class JAXBObjectEntityProvider implements EntityProvider<Object> {

    @Override
    public Object readFrom(Class<Object> type,
                           Type genericType,
                           Annotation[] annotations,
                           MediaType mediaType,
                           MultivaluedMap<String, String> httpHeaders,
                           InputStream entityStream) throws IOException {
        try {
            JAXBContext jaxbContext = getJAXBContext(type, mediaType);
            return jaxbContext.createUnmarshaller().unmarshal(entityStream);
        } catch (UnmarshalException e) {
            LOG.debug(e.getMessage(), e);
            return null;
        } catch (JAXBException e) {
            throw new IOException(String.format("Can't read from input stream, %s", e));
        }
    }

    public  JAXBObjectEntityProvider(@Context Providers providers);

}