MultivaluedMapEntityProvider implements EntityProvider<MultivaluedMap<String, String>> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == MultivaluedMap.class) { try { ParameterizedType parameterizedType = (ParameterizedType)genericType; Type[] typeArguments = parameterizedType.getActualTypeArguments(); return typeArguments.length == 2 && typeArguments[0] == String.class && typeArguments[1] == String.class; } catch (ClassCastException e) { return false; } } return false; } MultivaluedMapEntityProvider(@Context HttpServletRequest httpRequest); @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override @SuppressWarnings("unchecked") MultivaluedMap<String, String> readFrom(Class<MultivaluedMap<String, String>> type,
                                                   Type genericType,
                                                   Annotation[] annotations,
                                                   MediaType mediaType,
                                                   MultivaluedMap<String, String> httpHeaders,
                                                   InputStream entityStream); @Override long getSize(MultivaluedMap<String, String> multivaluedMap, Class<?> type, Type genericType, Annotation[] annotations,
                        MediaType mediaType); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(MultivaluedMap<String, String> multivaluedMap,
                        Class<?> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream);  }
@Test public void isReadableForMultivaluedMap() throws Exception { assertTrue(multivaluedMapEntityProvider.isReadable(MultivaluedMap.class, multiValuedMapGenericType, null, null)); }
@Test public void isNotReadableForTypeOtherThanMultivaluedMap() throws Exception { assertFalse(multivaluedMapEntityProvider.isReadable(Object.class, null, null, null)); }