Package org.jboss.errai.codegen.builder

Examples of org.jboss.errai.codegen.builder.ContextualStatementBuilder.invoke()


              Stmt.newObject(StringBuilder.class)
          )
      );
      final ContextualStatementBuilder csb = Stmt.loadVariable("json");
      marshallEnum(csb, Stmt.loadVariable("a0"), toMap);
      builder.append(csb.invoke("toString").returnValue());
      return;
    }

    builder.append(Stmt.declareFinalVariable("ref", boolean.class,
        Stmt.loadVariable("a1").invoke("hasObject", Refs.get("a0"))));
View Full Code Here


      if (!hasEncoded) {
        appendChain = Stmt.loadVariable("json").invoke("append", ",");
        hasEncoded = true;
      }
      else if (i > 0) {
        appendChain.invoke("append", ",");
      }

      final MetaClass targetType = GenUtil.getPrimitiveWrapper(mapping.getType());

      final MetaClass compType = targetType.isArray() ? targetType.getOuterComponentType().asBoxed() : targetType.asBoxed();
View Full Code Here

      Statement valueStatement = valueAccessorFor(mapping.getReadingMember());
      if (targetType.isArray()) {
        valueStatement = context.getArrayMarshallerCallback().marshal(targetType, valueStatement);
      }
      appendChain.invoke("append", "\"" + mapping.getKey() + "\":");


      if (targetType.isEnum()) {
        marshallEnum(appendChain, valueStatement, targetType);
      }
View Full Code Here

      if (targetType.isEnum()) {
        marshallEnum(appendChain, valueStatement, targetType);
      }
      else {
        appendChain.invoke("append",
            loadVariable(MarshallingGenUtil.getVarName(targetType))
                .invoke("marshall", valueStatement, loadVariable("a1")));
      }

      i++;
View Full Code Here

    if (i == 0) {
      if (appendChain == null) {
        appendChain = Stmt.loadVariable("json");
      }

      appendChain.invoke("append", ",\"" + SerializationParts.INSTANTIATE_ONLY + "\":true");
    }

    builder.append(appendChain.invoke("append", "}").invoke("toString").returnValue());
  }
View Full Code Here

      }

      appendChain.invoke("append", ",\"" + SerializationParts.INSTANTIATE_ONLY + "\":true");
    }

    builder.append(appendChain.invoke("append", "}").invoke("toString").returnValue());
  }

  private static String keyValue(final String key, final String value) {
    return "\"" + key + "\":" + value + "";
  }
View Full Code Here

      }
      Statement pathParam = marshal(params.getPathParameter(pathParamId));
      if (params.needsEncoding(pathParamId)) {
        pathParam = encodePath(pathParam);
      }
      pathValue = pathValue.invoke("replace", "{" + pathParamName + "}", pathParam);
    }

    if (params.getMatrixParameters() != null) {
      for (String matrixParamName : params.getMatrixParameters().keySet()) {
        pathValue = pathValue.invoke("concat", ";" + matrixParamName + "=")
View Full Code Here

      pathValue = pathValue.invoke("replace", "{" + pathParamName + "}", pathParam);
    }

    if (params.getMatrixParameters() != null) {
      for (String matrixParamName : params.getMatrixParameters().keySet()) {
        pathValue = pathValue.invoke("concat", ";" + matrixParamName + "=")
            .invoke("concat", encodePath(marshal(params.getMatrixParameter(matrixParamName))));
      }
    }

    ContextualStatementBuilder urlBuilder = Stmt.loadVariable("url").invoke(APPEND, pathValue);
View Full Code Here

    ContextualStatementBuilder urlBuilder = Stmt.loadVariable("url").invoke(APPEND, pathValue);
    block.addStatement(urlBuilder);

    // construct query using @QueryParams
    if (params.getQueryParameters() != null) {
      urlBuilder = urlBuilder.invoke(APPEND, "?");
      int i = 0;
      for (String queryParamName : params.getQueryParameters().keySet()) {
        for (Statement queryParam : params.getQueryParameters(queryParamName)) {

          MetaClass queryParamType = queryParam.getType();
View Full Code Here

        ContextualStatementBuilder headerValueBuilder = Stmt.nestedCall(Stmt.newObject(StringBuilder.class));

        int i = 0;
        for (Statement headerParam : params.getHeaderParameters(headerParamName)) {
          if (i++ > 0) {
            headerValueBuilder = headerValueBuilder.invoke(APPEND, ",");
          }
          headerValueBuilder = headerValueBuilder.invoke(APPEND, marshal(headerParam));
        }

        block.addStatement(Stmt.loadVariable("requestBuilder").invoke("setHeader", headerParamName,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.