@Test @SuppressWarnings("unchecked") public void testIsReadable() { ProvidenceMessageBodyReader reader = new DefaultProvidenceMessageBodyReader(); Annotation[] annotations = new Annotation[0]; assertTrue(reader.isReadable(Operand.class, null, annotations, MediaType.valueOf(JsonSerializer.MEDIA_TYPE))); assertTrue(reader.isReadable(Operand.class, null, annotations, MediaType.valueOf(JsonSerializer.JSON_MEDIA_TYPE + "; encoding=utf-8"))); assertTrue(reader.isReadable(Operand.class, null, annotations, MediaType.valueOf(BinarySerializer.MEDIA_TYPE))); assertTrue(reader.isReadable(Operand.class, null, annotations, MediaType.valueOf(BinarySerializer.ALT_MEDIA_TYPE))); assertFalse(reader.isReadable(PMap.class, null, annotations, MediaType.valueOf(BinarySerializer.MEDIA_TYPE))); assertFalse(reader.isReadable(String.class, null, annotations, MediaType.valueOf(BinarySerializer.ALT_MEDIA_TYPE))); assertFalse(reader.isReadable(Operand.class, null, annotations, MediaType.WILDCARD_TYPE)); assertFalse(reader.isReadable(Operand.class, null, annotations, MediaType.TEXT_PLAIN_TYPE)); }
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == null || getDescriptor(type) == null || MediaType.WILDCARD_TYPE.equals(mediaType)) { return false; } try { provider.getSerializer(mediaType.toString()); return true; } catch (Exception e) { return false; } }
ProvidenceMessageBodyReader implements MessageBodyReader<PMessage> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == null || getDescriptor(type) == null || MediaType.WILDCARD_TYPE.equals(mediaType)) { return false; } try { provider.getSerializer(mediaType.toString()); return true; } catch (Exception e) { return false; } } }
ProvidenceMessageBodyReader implements MessageBodyReader<PMessage> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == null || getDescriptor(type) == null || MediaType.WILDCARD_TYPE.equals(mediaType)) { return false; } try { provider.getSerializer(mediaType.toString()); return true; } catch (Exception e) { return false; } } protected  ProvidenceMessageBodyReader(SerializerProvider provider); }
ProvidenceMessageBodyReader implements MessageBodyReader<PMessage> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == null || getDescriptor(type) == null || MediaType.WILDCARD_TYPE.equals(mediaType)) { return false; } try { provider.getSerializer(mediaType.toString()); return true; } catch (Exception e) { return false; } } protected  ProvidenceMessageBodyReader(SerializerProvider provider); @Override boolean isReadable(Class<?> type,
                              Type genericType,
                              Annotation[] annotations,
                              MediaType mediaType); @Override PMessage readFrom(Class<PMessage> type,
                             Type genericType,
                             Annotation[] annotations,
                             MediaType mediaType,
                             MultivaluedMap<String, String> httpHeaders,
                             InputStream entityStream); }
ProvidenceMessageBodyReader implements MessageBodyReader<PMessage> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == null || getDescriptor(type) == null || MediaType.WILDCARD_TYPE.equals(mediaType)) { return false; } try { provider.getSerializer(mediaType.toString()); return true; } catch (Exception e) { return false; } } protected  ProvidenceMessageBodyReader(SerializerProvider provider); @Override boolean isReadable(Class<?> type,
                              Type genericType,
                              Annotation[] annotations,
                              MediaType mediaType); @Override PMessage readFrom(Class<PMessage> type,
                             Type genericType,
                             Annotation[] annotations,
                             MediaType mediaType,
                             MultivaluedMap<String, String> httpHeaders,
                             InputStream entityStream);  }