package com.gingersoft.gsa.cloud.function;


import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
import org.openjdk.javax.annotation.processing.AbstractProcessor;
import org.openjdk.javax.annotation.processing.ProcessingEnvironment;
import org.openjdk.javax.annotation.processing.Processor;
import org.openjdk.javax.annotation.processing.RoundEnvironment;
import org.openjdk.javax.lang.model.SourceVersion;
import org.openjdk.javax.lang.model.element.Element;
import org.openjdk.javax.lang.model.element.ElementKind;
import org.openjdk.javax.lang.model.element.Modifier;
import org.openjdk.javax.lang.model.element.TypeElement;
import java.util.Set;

/**
 * @author : bin
 * @create date: 2020-11-22
 * @update date: 2020-11-22
 * @description:
 */
//@AutoService(Processor.class)
public class XFunctionProcessor extends AbstractProcessor {

    // 2
    @Override
    public synchronized void init(ProcessingEnvironment env) {

    }

    // 3
    @Override
    public boolean process(Set<? extends TypeElement> annoations, RoundEnvironment roundEnv) {
//        for (Element element : roundEnv.getElementsAnnotatedWith(XFunctionComponent.class)) {
//            if (element.getKind() != ElementKind.CLASS) {
//                continue;
////            }
            /**
             * 遍歷所有組件註解
             */

//            for (Element element2 : roundEnv.getElementsAnnotatedWith(XFunctionPage.class)) {
//                if (element2.getKind() != ElementKind.CLASS) {
//                    continue;
//                }
                /**
                 * 遍歷所有Activity、Fragment、Dialog等頁面註解
                 */

//                for (Element element3 : roundEnv.getElementsAnnotatedWith(XFunctionItems.class)) {
//                    if (element3.getKind() != ElementKind.METHOD) {
//                        continue;
//                    }
//                    /**
//                     * 遍歷所有RecycleView,GridView等功能組註解
//                     */
//
//                }
//                for (Element element4 : roundEnv.getElementsAnnotatedWith(XFunctionItem.class)) {
//                    if (element4.getKind() != ElementKind.METHOD) {
//                        continue;
//                    }
//                    /**
//                     * 遍歷所有button，textview等單個功能註解
//                     */
//
//                }
//            }
//        }
        return true;
    }

    // 4
    @Override
    public Set<String> getSupportedAnnotationTypes() {
        return null;
    }

    // 5
    @Override
    public SourceVersion getSupportedSourceVersion() {
        return null;
    }
}
