Пример #1
0
  /**
   * Loads the overridden resource parameter values.
   *
   * @param signatureOverride The signature override.
   * @return The explicit resource parameters.
   */
  protected List<ResourceParameter> loadResourceParameters(
      ResourceMethodSignature signatureOverride) {
    HashMap<String, String> paramComments = parseParamComments(getJavaDoc());

    ArrayList<ResourceParameter> params = new ArrayList<ResourceParameter>();
    for (CookieParam cookieParam : signatureOverride.cookieParams()) {
      params.add(
          new ExplicitResourceParameter(
              this,
              paramComments.get(cookieParam.value()),
              cookieParam.value(),
              ResourceParameterType.COOKIE));
    }
    for (MatrixParam matrixParam : signatureOverride.matrixParams()) {
      params.add(
          new ExplicitResourceParameter(
              this,
              paramComments.get(matrixParam.value()),
              matrixParam.value(),
              ResourceParameterType.MATRIX));
    }
    for (QueryParam queryParam : signatureOverride.queryParams()) {
      params.add(
          new ExplicitResourceParameter(
              this,
              paramComments.get(queryParam.value()),
              queryParam.value(),
              ResourceParameterType.QUERY));
    }
    for (PathParam pathParam : signatureOverride.pathParams()) {
      params.add(
          new ExplicitResourceParameter(
              this,
              paramComments.get(pathParam.value()),
              pathParam.value(),
              ResourceParameterType.PATH));
    }
    for (HeaderParam headerParam : signatureOverride.headerParams()) {
      params.add(
          new ExplicitResourceParameter(
              this,
              paramComments.get(headerParam.value()),
              headerParam.value(),
              ResourceParameterType.HEADER));
    }
    for (FormParam formParam : signatureOverride.formParams()) {
      params.add(
          new ExplicitResourceParameter(
              this,
              paramComments.get(formParam.value()),
              formParam.value(),
              ResourceParameterType.FORM));
    }

    return params;
  }
Пример #2
0
 private String pathExpression(String pathExpression, JParameter arg, PathParam paramPath) {
   String expr = toStringExpression(arg);
   return pathExpression.replaceAll(
       Pattern.quote("{" + paramPath.value() + "}"),
       "\"+("
           + expr
           + "== null? null : com.google.gwt.http.client.URL.encodePathSegment("
           + expr
           + "))+\"");
 }