コード例 #1
0
  @SuppressWarnings("deprecation")
  protected void generateOperationMethod(
      JDefinedClass serviceCls,
      String operationName,
      List<ElementType> inputTypes,
      Integer overloadCount)
      throws GenerationException {

    ElementType outputType1 = this.serviceDefinition.getOutputType(operationName);
    ElementType outputType = getAdjustedOutputType(outputType1);

    JType outputJType = getAdjustedJType(outputType);

    Map<String, JType> inputJTypeMap = new LinkedHashMap<String, JType>();
    JMethod method = serviceCls.method(JMod.PUBLIC, outputJType, operationName);
    for (ElementType inputType : inputTypes) {
      JType paramJType = getJType(inputType);
      String paramName = inputType.getName();
      method.param(paramJType, paramName);
      inputJTypeMap.put(paramName, paramJType);
    }

    addAdditionalInputParams(method, operationName);

    JBlock body = method.body();

    JTryBlock tryBlock = null;

    if (this.useNDCLogging) {
      tryBlock = body._try();
      body = tryBlock.body();
      body.staticInvoke(this.codeModel.ref(NDC.class), NDC_PUSH)
          .arg(getClassName() + "." + operationName);
    }

    generateOperationMethodBody(
        method,
        body,
        operationName,
        inputJTypeMap,
        outputType,
        outputJType,
        overloadCount); // salesforce

    if (this.useNDCLogging) {
      tryBlock._finally().block().staticInvoke(this.codeModel.ref(NDC.class), NDC_POP);
    }
  }