public T fromAnnotations() { Annotation[] annotations = parameter.getAnnotations(); AccessibleObject injectTarget = parameter.getAccessibleObject(); Class<?> type = parameter.getResourceClass().getClazz(); parameter.encoded = findAnnotation(annotations, Encoded.class) != null || injectTarget.isAnnotationPresent(Encoded.class) || type.isAnnotationPresent(Encoded.class); DefaultValue defaultValue = findAnnotation(annotations, DefaultValue.class); if (defaultValue != null) parameter.defaultValue = defaultValue.value(); QueryParam query; HeaderParam header; MatrixParam matrix; PathParam uriParam; CookieParam cookie; FormParam formParam; Form form; Suspend suspend; Suspended suspended; if ((query = findAnnotation(annotations, QueryParam.class)) != null) { parameter.paramType = Parameter.ParamType.QUERY_PARAM; parameter.paramName = query.value(); } else if ((header = findAnnotation(annotations, HeaderParam.class)) != null) { parameter.paramType = Parameter.ParamType.HEADER_PARAM; parameter.paramName = header.value(); } else if ((formParam = findAnnotation(annotations, FormParam.class)) != null) { parameter.paramType = Parameter.ParamType.FORM_PARAM; parameter.paramName = formParam.value(); } else if ((cookie = findAnnotation(annotations, CookieParam.class)) != null) { parameter.paramType = Parameter.ParamType.COOKIE_PARAM; parameter.paramName = cookie.value(); } else if ((uriParam = findAnnotation(annotations, PathParam.class)) != null) { parameter.paramType = Parameter.ParamType.PATH_PARAM; parameter.paramName = uriParam.value(); } else if ((form = findAnnotation(annotations, Form.class)) != null) { parameter.paramType = Parameter.ParamType.FORM; parameter.paramName = form.prefix(); } else if (findAnnotation(annotations, BeanParam.class) != null) { parameter.paramType = Parameter.ParamType.BEAN_PARAM; } else if ((matrix = findAnnotation(annotations, MatrixParam.class)) != null) { parameter.paramType = Parameter.ParamType.MATRIX_PARAM; parameter.paramName = matrix.value(); } else if ((suspend = findAnnotation(annotations, Suspend.class)) != null) { parameter.paramType = Parameter.ParamType.SUSPEND; parameter.suspendTimeout = suspend.value(); } else if (findAnnotation(annotations, Context.class) != null) { parameter.paramType = Parameter.ParamType.CONTEXT; } else if ((suspended = findAnnotation(annotations, Suspended.class)) != null) { parameter.paramType = Parameter.ParamType.SUSPENDED; } else if (javax.ws.rs.container.AsyncResponse.class.isAssignableFrom(type)) { parameter.paramType = Parameter.ParamType.SUSPENDED; } else if (findAnnotation(annotations, Body.class) != null) { parameter.paramType = Parameter.ParamType.MESSAGE_BODY; } else { parameter.paramType = Parameter.ParamType.UNKNOWN; } return (T) this; }
public T encoded() { parameter.encoded = true; return (T) this; }