JAXBElementEntityProvider implements EntityProvider<JAXBElement<?>> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return JAXBElement.class.isAssignableFrom(type); } JAXBElementEntityProvider(@Context Providers providers); @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override JAXBElement<?> readFrom(Class<JAXBElement<?>> type,
                                   Type genericType,
                                   Annotation[] annotations,
                                   MediaType mediaType,
                                   MultivaluedMap<String, String> httpHeaders,
                                   InputStream entityStream); @Override long getSize(JAXBElement<?> t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(JAXBElement<?> t,
                        Class<?> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream);  }
@Test public void isWriteableForJAXBElement() throws Exception { assertTrue(writer.isWriteable(JAXBElement.class, null, null, null)); }
@Test public void isNotWriteableForTypeOtherThanJAXBElement() throws Exception { Type genericType = newParameterizedType(JAXBElement.class, Book.class); assertFalse(writer.isWriteable(String.class, genericType, null, null)); }