public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return FindAnnotation.findAnnotation(annotations, XopWithMultipartRelated.class) != null || type.isAnnotationPresent(XopWithMultipartRelated.class); }
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return FindAnnotation.findAnnotation(annotations, MultipartForm.class) != null || type.isAnnotationPresent(MultipartForm.class); }
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return FindAnnotation.findAnnotation(annotations, XopWithMultipartRelated.class) != null || type.isAnnotationPresent(XopWithMultipartRelated.class); }
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return List.class.isAssignableFrom(type) && FindAnnotation.findAnnotation(annotations, PartType.class) != null; }
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Map.class.isAssignableFrom(type) && FindAnnotation.findAnnotation(annotations, PartType.class) != null; }
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return FindAnnotation.findAnnotation(annotations, MultipartForm.class) != null || type.isAnnotationPresent(MultipartForm.class); }
public static Class<? extends Annotation>[] findJsonBindingAnnotations(Annotation[] searchList) { LinkedList<Class<? extends Annotation>> result = new LinkedList<Class<? extends Annotation>>(); for (Class<? extends Annotation> clazz : JSON_BINDING_ANNOTATIONS) { if (findAnnotation(searchList, clazz) != null) result.add(clazz); } return result.toArray(findJaxRSAnnotations_TYPE); }
public static Class<? extends Annotation>[] findJaxRSAnnotations(Annotation[] searchList) { LinkedList<Class<? extends Annotation>> result = new LinkedList<Class<? extends Annotation>>(); for (Class<? extends Annotation> clazz : JAXRS_ANNOTATIONS) { if (findAnnotation(searchList, clazz) != null) result.add(clazz); } return result.toArray(findJaxRSAnnotations_TYPE); }
@Override public boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType) { if (FindAnnotation.findAnnotation(aClass, annotations, NoJackson.class) != null) return false; return super.isWriteable(aClass, type, annotations, mediaType); }
@Override public boolean isReadable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType) { if (FindAnnotation.findAnnotation(aClass, annotations, NoJackson.class) != null) return false; return super.isReadable(aClass, type, annotations, mediaType); }
@SuppressWarnings("unchecked") @Override public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) { if (rawType.equals(Date.class)) { DateFormat format = FindAnnotation.findAnnotation(annotations, DateFormat.class); return (ParamConverter<T>) new DateFormatter(format); } return null; } }
@Override public void setAnnotations(Annotation[] annotations) { DateFormat format = FindAnnotation.findAnnotation(annotations, DateFormat.class); formatter = new SimpleDateFormat(format.value()); }
private ValueInjector getParameterExtractor(Class<?> clazz, ResteasyProviderFactory factory, AccessibleObject accessibleObject, Annotation[] annotations, Class<?> type, Type genericType) { boolean extractBody = (FindAnnotation.findAnnotation(annotations, Body.class) != null); ValueInjector injector = factory.getInjectorFactory().createParameterExtractor(clazz, accessibleObject, type, genericType, annotations, extractBody, factory); return injector; }
@Override protected JAXBContext createContextObject(Annotation[] annotations, Class... classes) throws JAXBException { JAXBConfig config = FindAnnotation.findAnnotation(annotations, JAXBConfig.class); JAXBContext context = new FastinfoSetContext(classes); return new JAXBContextWrapper(context, config); }
@Override protected JAXBContext createContextObject(Annotation[] annotations, String contextPath) throws JAXBException { JAXBConfig config = FindAnnotation.findAnnotation(annotations, JAXBConfig.class); JAXBContext context = new FastinfoSetContext(contextPath); return new JAXBContextWrapper(context, config); } }
@Override public void setAnnotations(Annotation[] ann) { Required r = FindAnnotation.findAnnotation(ann, Required.class); this.fieldName = r.value(); this.validValues = r.validValues(); }
@Override public MultivaluedMap readFrom(Class<MultivaluedMap> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (!useContainerParams) return super.readFrom(type, genericType, annotations, mediaType, httpHeaders, entityStream); boolean encoded = FindAnnotation.findAnnotation(annotations, Encoded.class) != null; if (encoded) return request.getFormParameters(); else return request.getDecodedFormParameters(); } }
public void writeTo(Map<String, Object> map, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { PartType partType = FindAnnotation.findAnnotation(annotations, PartType.class); MediaType partMediaType = MediaType.valueOf(partType.value()); MultipartFormDataOutput output = new MultipartFormDataOutput(); for (Map.Entry<String, Object> entry : map.entrySet()) { output.addFormData(entry.getKey(), entry.getValue(), partMediaType); } write(output, mediaType, httpHeaders, entityStream); } }
public MultivaluedMap readFrom(Class<MultivaluedMap> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); if (NoContent.isContentLengthZero(httpHeaders)) return new MultivaluedMapImpl<String, String>(); boolean encoded = FindAnnotation.findAnnotation(annotations, Encoded.class) != null; String charset = mediaType.getParameters().get(MediaType.CHARSET_PARAMETER); if (charset == null) { charset = StandardCharsets.UTF_8.name(); } if (encoded) return parseForm(entityStream, charset); else return Encode.decode(parseForm(entityStream, charset), charset); }
public void writeTo(List<Object> list, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { PartType partType = FindAnnotation.findAnnotation(annotations, PartType.class); MediaType partMediaType = MediaType.valueOf(partType.value()); MultipartOutput output = new MultipartOutput(); for (Object obj : list) { output.addPart(obj, partMediaType); } write(output, mediaType, httpHeaders, entityStream); } }