Example #1
0
 private void buildAsyncMethod(SectorMethod sectorMethod) {
   AsyncMethod.Builder asyncBuilder = new AsyncMethod.Builder();
   asyncBuilder.methodElement = methodElement;
   asyncBuilder.sectorMethod = sectorMethod;
   asyncBuilder.classElement = classElement;
   sectorMethod.asyncMethod = asyncBuilder.build();
 }
Example #2
0
    public SectorMethod build() {
      SectorMethod method = new SectorMethod();
      String methodName = methodElement.getSimpleName().toString();
      SectorOperation operationAnnotation = methodElement.getAnnotation(SectorOperation.class);
      if (operationAnnotation == null) {
        return null;
      }

      int argCount = methodElement.getParameters().size();

      method.cellbased = operationAnnotation.cellbased();
      method.name = "hz_" + methodName;

      method.returnType = methodElement.getReturnType().toString();
      method.invocationClassName =
          CodeGenerationUtils.capitalizeFirstLetter(methodName) + argCount + "Invocation";
      method.targetMethod = methodName;
      method.readonly = operationAnnotation.readonly();
      method.functionId = sectorClassModel.getMethods().size();

      List<FormalArgument> args = new LinkedList<>();

      for (VariableElement variableElement : methodElement.getParameters()) {
        FormalArgument formalArgument = new FormalArgument();
        if (method.cellbased && args.isEmpty()) {
          formalArgument.name = "id";
          formalArgument.type = "long";
        } else {
          formalArgument.name = "arg" + (args.size() + 1);
          formalArgument.type = variableElement.asType().toString();
        }
        args.add(formalArgument);
      }

      method.formalArguments = args;

      buildOriginalMethos(method);

      buildAsyncMethod(method);

      return method;
    }
Example #3
0
 private void buildOriginalMethos(SectorMethod sectorMethod) {
   OriginalMethod.Builder originalBuilder = new OriginalMethod.Builder();
   originalBuilder.methodElement = methodElement;
   sectorMethod.originalMethod = originalBuilder.build();
 }