@Test public void isNotReadableWhenGenericTypeIsNotAvailable() throws Exception { Class<Map> type = Map.class; assertFalse(mapMultipartFormDataMessageBodyReader.isReadable(type, null, new Annotation[0], null)); }
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == Map.class && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 2 && ta[0] == String.class && ta[1] == InputItem.class; } return false; }
MapMultipartFormDataMessageBodyReader implements MessageBodyReader<Map<String, InputItem>> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == Map.class && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 2 && ta[0] == String.class && ta[1] == InputItem.class; } return false; } }
MapMultipartFormDataMessageBodyReader implements MessageBodyReader<Map<String, InputItem>> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == Map.class && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 2 && ta[0] == String.class && ta[1] == InputItem.class; } return false; } MapMultipartFormDataMessageBodyReader(@Context Providers providers); }
MapMultipartFormDataMessageBodyReader implements MessageBodyReader<Map<String, InputItem>> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == Map.class && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 2 && ta[0] == String.class && ta[1] == InputItem.class; } return false; } MapMultipartFormDataMessageBodyReader(@Context Providers providers); @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override Map<String, InputItem> readFrom(Class<Map<String, InputItem>> type, Type genericType, Annotation[] annotations,
                                           MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream); }
MapMultipartFormDataMessageBodyReader implements MessageBodyReader<Map<String, InputItem>> { @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type == Map.class && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 2 && ta[0] == String.class && ta[1] == InputItem.class; } return false; } MapMultipartFormDataMessageBodyReader(@Context Providers providers); @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override Map<String, InputItem> readFrom(Class<Map<String, InputItem>> type, Type genericType, Annotation[] annotations,
                                           MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream);  }