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 pathParam(String name) {
   parameter.paramType = Parameter.ParamType.PATH_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
 public T queryParam(String name) {
   parameter.paramType = Parameter.ParamType.QUERY_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
 public T headerParam(String name) {
   parameter.paramType = Parameter.ParamType.HEADER_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
 public T matrixParam(String name) {
   parameter.paramType = Parameter.ParamType.MATRIX_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
 /**
  * Resteasy @Form specific injection parameter
  *
  * @param prefix
  * @return
  */
 public T form(String prefix) {
   parameter.paramType = Parameter.ParamType.FORM;
   parameter.paramName = prefix;
   return (T) this;
 }
 /**
  * Resteasy @Form specific injection parameter
  *
  * @return
  */
 public T form() {
   parameter.paramType = Parameter.ParamType.FORM;
   parameter.paramName = "";
   return (T) this;
 }
 public T formParam(String name) {
   parameter.paramType = Parameter.ParamType.FORM_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
 public T cookieParam(String name) {
   parameter.paramType = Parameter.ParamType.COOKIE_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
示例#10
0
 public T messageBody() {
   parameter.paramType = Parameter.ParamType.MESSAGE_BODY;
   return (T) this;
 }
示例#11
0
 public T context() {
   parameter.paramType = Parameter.ParamType.CONTEXT;
   return (T) this;
 }
示例#12
0
 public T beanParam() {
   parameter.paramType = Parameter.ParamType.BEAN_PARAM;
   return (T) this;
 }