@Test public void isNotWriteableWhenGenericTypeIsNotAvailable() throws Exception { Class<Collection> type = Collection.class; assertFalse(collectionMultipartFormDataMessageBodyWriter.isWriteable(type, null, new Annotation[0], null)); }
@Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (Collection.class.isAssignableFrom(type) && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 1 && ta[0] instanceof Class && OutputItem.class.isAssignableFrom((Class<?>)ta[0]); } return false; }
CollectionMultipartFormDataMessageBodyWriter implements MessageBodyWriter<Collection<OutputItem>> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (Collection.class.isAssignableFrom(type) && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 1 && ta[0] instanceof Class && OutputItem.class.isAssignableFrom((Class<?>)ta[0]); } return false; } }
CollectionMultipartFormDataMessageBodyWriter implements MessageBodyWriter<Collection<OutputItem>> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (Collection.class.isAssignableFrom(type) && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 1 && ta[0] instanceof Class && OutputItem.class.isAssignableFrom((Class<?>)ta[0]); } return false; } CollectionMultipartFormDataMessageBodyWriter(@Context Providers providers);   CollectionMultipartFormDataMessageBodyWriter(MultipartFormDataWriter multipartFormDataWriter); }
CollectionMultipartFormDataMessageBodyWriter implements MessageBodyWriter<Collection<OutputItem>> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (Collection.class.isAssignableFrom(type) && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 1 && ta[0] instanceof Class && OutputItem.class.isAssignableFrom((Class<?>)ta[0]); } return false; } CollectionMultipartFormDataMessageBodyWriter(@Context Providers providers);   CollectionMultipartFormDataMessageBodyWriter(MultipartFormDataWriter multipartFormDataWriter); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override long getSize(Collection<OutputItem> items, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Collection<OutputItem> items, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream); }
CollectionMultipartFormDataMessageBodyWriter implements MessageBodyWriter<Collection<OutputItem>> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (Collection.class.isAssignableFrom(type) && genericType instanceof ParameterizedType) { ParameterizedType t = (ParameterizedType)genericType; Type[] ta = t.getActualTypeArguments(); return ta.length == 1 && ta[0] instanceof Class && OutputItem.class.isAssignableFrom((Class<?>)ta[0]); } return false; } CollectionMultipartFormDataMessageBodyWriter(@Context Providers providers);   CollectionMultipartFormDataMessageBodyWriter(MultipartFormDataWriter multipartFormDataWriter); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override long getSize(Collection<OutputItem> items, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Collection<OutputItem> items, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream);  }