public void process()

in fastmodel-processor/src/main/java/com/aliyun/fastmodel/annotation/processor/AstBuilderProcessor.java [115:164]


    public void process(Set<? extends Element> executeElement) {
        List<MethodSpec> methodSpecs = new ArrayList<>();
        List<FieldSpec> fieldSpecs = new ArrayList<>();
        Element enclosingElement = null;
        for (Element e : executeElement) {
            ExecutableElement executableElement = (ExecutableElement)e;
            String name = e.getSimpleName().toString();
            Builder spec = MethodSpec.methodBuilder(name)
                .addAnnotation(Override.class)
                .addModifiers(e.getModifiers()).returns(
                    TypeName.get(executableElement.getReturnType())
                );
            int size = executableElement.getParameters().size();
            String name1 = null;
            for (int i = 0; i < size; i++) {
                VariableElement variableElement = executableElement.getParameters().get(i);
                name1 = variableElement.getSimpleName().toString();
                spec.addParameter(TypeName.get(variableElement.asType()),
                    name1);
            }
            enclosingElement = executableElement.getEnclosingElement();

            TypeMirror typeMirror = null;
            if (enclosingElement != null) {
                typeMirror = enclosingElement.asType();
            } else {
                messager.printMessage(Kind.ERROR, "enclosing element is null");
            }
            ClassName className = ClassName.get((TypeElement)enclosingElement);
            String capitalize = StringUtils.uncapitalize(className.simpleName());
            TypeName type = TypeName.get(typeMirror);
            FieldSpec fieldSpec = FieldSpec.builder(type, capitalize).addModifiers(Modifier.PRIVATE)
                .initializer(
                    "new $T()", type
                ).build();
            spec.addStatement("return $N.$L($N)", capitalize, name, name1);
            methodSpecs.add(spec.build());
            if (!fieldSpecs.contains(fieldSpec)) {
                fieldSpecs.add(fieldSpec);
            }
        }
        if (enclosingElement == null) {
            return;
        }
        try {
            write(methodSpecs, fieldSpecs, enclosingElement);
        } catch (IOException e) {
            messager.printMessage(Kind.ERROR, e.getMessage());
        }
    }