// Path: library-compiler/src/main/java/com/wangjie/rapidorm/compiler/util/GlobalEnvironment.java
// public class GlobalEnvironment {
//     private static ProcessingEnvironment processingEnv;
// 
//     public static void init(ProcessingEnvironment processingEnv){
//         GlobalEnvironment.processingEnv = processingEnv;
//     }
//     public static ProcessingEnvironment getProcessingEnv() {
//         return processingEnv;
//     }
// }
// 
// Path: library-compiler/src/main/java/com/wangjie/rapidorm/compiler/util/LogUtil.java
// public class LogUtil {
//     public static final boolean LOG_CONTROL = true;
//     public static final boolean LOG_FILE = false;
//     private static SimpleDateFormat LOGGER_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:sss");
// 
// 
//     public static void loggerE(Throwable throwable) {
//         if (!LOG_CONTROL && !LOG_FILE) {
//             return;
//         }
//         logger("[ERROR]" + transformStackTrace(throwable));
//     }
// 
//     public static void logger(String str) {
//         if (!LOG_CONTROL && !LOG_FILE) {
//             return;
//         }
//         String loggerDate = "...[" + LOGGER_DATE_FORMAT.format(new Date()) + "]";
//         String log = loggerDate + ": " + str;
//         if (LOG_CONTROL) {
//             GlobalEnvironment.getProcessingEnv().getMessager().printMessage(Diagnostic.Kind.NOTE, log);
//         }
//         if (LOG_FILE) {
//             writeToDisk(log);
//         }
//     }
// 
//     private static void writeToDisk(String log) {
//         try {
//             File logFile = new File("/Users/wangjie/Desktop/za/test/rapidorm/processor_http.txt");
//             if (!logFile.exists()) {
//                 logFile.getParentFile().mkdirs();
//                 logFile.createNewFile();
//             }
//             FileWriter fw = new FileWriter(logFile, true);
//             fw.write(log + "\n\n");
//             fw.close();
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public static StringBuilder transformStackTrace(StackTraceElement[] elements){
//         StringBuilder sb = new StringBuilder();
//         for(StackTraceElement element : elements){
//             sb.append(element.toString()).append("\r\n");
//         }
//         return sb;
//     }
//     public static String transformStackTrace(Throwable throwable){
//         if(null == throwable){
//             return "throwable is null";
//         }
//         StringBuilder sb = new StringBuilder(throwable.getMessage()).append("\n");
//         for(StackTraceElement element : throwable.getStackTrace()){
//             sb.append(element.toString()).append("\r\n");
//         }
//         return sb.toString();
//     }
// 
// }


import com.google.auto.common.MoreElements;
import com.wangjie.rapidorm.compiler.util.GlobalEnvironment;
import com.wangjie.rapidorm.compiler.util.LogUtil;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
        LogUtil.logger(str);
    }


    /**
     * Get class name of special element
     */
    protected String getElementOwnerClassName(Element element) {
        String clazzName;

        // todo: Get the Class which element's owner.
        ElementKind elementKind = element.getKind();
        if (ElementKind.FIELD == elementKind) {
            clazzName = MoreElements.asVariable(element).getEnclosingElement().toString();
            logger("[getDIClazzSafe]MoreElements.asVariable().getEnclosingElement(): " + MoreElements.asVariable(element).getEnclosingElement());
        } else if (ElementKind.METHOD == elementKind) {
            clazzName = MoreElements.asExecutable(element).getEnclosingElement().toString();
        } else {
            clazzName = typeUtils.erasure(element.asType()).toString();
        }


        return clazzName;
    }

    protected Element getElementOwnerElement(Element element) {
        Element resultEle;

        // todo: Get the Class which element's owner.
        ElementKind elementKind = element.getKind();
// Path: library-compiler/src/main/java/com/wangjie/rapidorm/compiler/util/GlobalEnvironment.java
// public class GlobalEnvironment {
//     private static ProcessingEnvironment processingEnv;
// 
//     public static void init(ProcessingEnvironment processingEnv){
//         GlobalEnvironment.processingEnv = processingEnv;
//     }
//     public static ProcessingEnvironment getProcessingEnv() {
//         return processingEnv;
//     }
// }
// 
// Path: library-compiler/src/main/java/com/wangjie/rapidorm/compiler/util/LogUtil.java
// public class LogUtil {
//     public static final boolean LOG_CONTROL = true;
//     public static final boolean LOG_FILE = false;
//     private static SimpleDateFormat LOGGER_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:sss");
// 
// 
//     public static void loggerE(Throwable throwable) {
//         if (!LOG_CONTROL && !LOG_FILE) {
//             return;
//         }
//         logger("[ERROR]" + transformStackTrace(throwable));
//     }
// 
//     public static void logger(String str) {
//         if (!LOG_CONTROL && !LOG_FILE) {
//             return;
//         }
//         String loggerDate = "...[" + LOGGER_DATE_FORMAT.format(new Date()) + "]";
//         String log = loggerDate + ": " + str;
//         if (LOG_CONTROL) {
//             GlobalEnvironment.getProcessingEnv().getMessager().printMessage(Diagnostic.Kind.NOTE, log);
//         }
//         if (LOG_FILE) {
//             writeToDisk(log);
//         }
//     }
// 
//     private static void writeToDisk(String log) {
//         try {
//             File logFile = new File("/Users/wangjie/Desktop/za/test/rapidorm/processor_http.txt");
//             if (!logFile.exists()) {
//                 logFile.getParentFile().mkdirs();
//                 logFile.createNewFile();
//             }
//             FileWriter fw = new FileWriter(logFile, true);
//             fw.write(log + "\n\n");
//             fw.close();
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public static StringBuilder transformStackTrace(StackTraceElement[] elements){
//         StringBuilder sb = new StringBuilder();
//         for(StackTraceElement element : elements){
//             sb.append(element.toString()).append("\r\n");
//         }
//         return sb;
//     }
//     public static String transformStackTrace(Throwable throwable){
//         if(null == throwable){
//             return "throwable is null";
//         }
//         StringBuilder sb = new StringBuilder(throwable.getMessage()).append("\n");
//         for(StackTraceElement element : throwable.getStackTrace()){
//             sb.append(element.toString()).append("\r\n");
//         }
//         return sb.toString();
//     }
// 
// }


// Path: library-compiler/src/main/java/com/wangjie/rapidorm/compiler/base/BaseAbstractProcessor.java
import com.google.auto.common.MoreElements;
import com.wangjie.rapidorm.compiler.util.GlobalEnvironment;
import com.wangjie.rapidorm.compiler.util.LogUtil;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

        LogUtil.logger(str);
    }


    /**
     * Get class name of special element
     */
    protected String getElementOwnerClassName(Element element) {
        String clazzName;

        // todo: Get the Class which element's owner.
        ElementKind elementKind = element.getKind();
        if (ElementKind.FIELD == elementKind) {
            clazzName = MoreElements.asVariable(element).getEnclosingElement().toString();
            logger("[getDIClazzSafe]MoreElements.asVariable().getEnclosingElement(): " + MoreElements.asVariable(element).getEnclosingElement());
        } else if (ElementKind.METHOD == elementKind) {
            clazzName = MoreElements.asExecutable(element).getEnclosingElement().toString();
        } else {
            clazzName = typeUtils.erasure(element.asType()).toString();
        }


        return clazzName;
    }

    protected Element getElementOwnerElement(Element element) {
        Element resultEle;

        // todo: Get the Class which element's owner.
        ElementKind elementKind = element.getKind();
        if (ElementKind.FIELD == elementKind) {