// Path: holder-compiler/src/main/java/com/steve/creact/processor/core/Constants.java
// public final class Constants {
//     private Constants(){}
// 
//     public static final String TEMPLATE_PATH = "templates/databean-source.tm";
//     public static final String PACKAGE_NAME = "${PACKAGE_NAME}";
//     public static final String DATA_ENTITY_FULL_QUALIFIED_CLASS_NAME = "${DATA_ENTITY_FULL_QUALIFIED_CLASS_NAME}";
//     public static final String VIEW_HOLDER_FULL_QUALIFIED_CLASS_NAME = "${VIEW_HOLDER_FULL_QUALIFIED_CLASS_NAME}";
//     public static final String VIEW_HOLDER_SIMPLE_CLASS_NAME = "${VIEW_HOLDER_SIMPLE_CLASS_NAME}";
//     public static final String DATA_BEAN_SIMPLE_CLASS_NAME = "${DATA_BEAN_SIMPLE_CLASS_NAME}";
//     public static final String DATA_ENTITY_SIMPLE_CLASS_NAME = "${DATA_ENTITY_SIMPLE_CLASS_NAME}";
// }
// 
// Path: holder-compiler/src/main/java/com/steve/creact/processor/core/Logger.java
// public class Logger {
//     public static boolean logOn = false;
//     public static Logger getInstance(Messager messager) {
//         if (instance == null) {
//             synchronized (Logger.class) {
//                 if (instance != null)
//                     return instance;
//                 instance = new Logger(messager);
//             }
//         }
//         return instance;
//     }
// 
//     private static Messager actual;
//     private static volatile Logger instance;
//     private Logger(Messager actual) {
//         this.actual = actual;
//     }
// 
//     public void log(Diagnostic.Kind kind, String message) {
//         if (logOn && actual != null) {
//             actual.printMessage(kind, message);
//         }
//     }
// }
// 
// Path: holder-compiler/src/main/java/com/steve/creact/processor/core/model/AbstractModel.java
// public abstract class AbstractModel<R> {
// 
//     protected Element element;
//     protected ElementVisitorAdapter elementVisitor;
//     /**
//      * real model
//      */
//     private R model;
// 
//     public AbstractModel(Element element) {
//         this.element = element;
//     }
// 
//     public boolean isClass() {
//         return element.getKind().isClass();
//     }
// 
//     public boolean isInterface() {
//         return element.getKind().isInterface();
//     }
// 
//     public boolean isField() {
// 
//         return element.getKind().isField();
//     }
// 
//     public String getSimpleName() {
//         return element.getSimpleName().toString();
//     }
// 
//     public <P> void visit(P p) {
//         model = (R) element.accept(this.elementVisitor, p);
//     }
// 
//     public <P> void setElementVisitor(ElementVisitorAdapter<R, P> visitor) {
//         this.elementVisitor = visitor;
//     }
// 
//     public R getRealModel() {
//         return model;
//     }
// 
// }


import com.steve.creact.processor.core.Constants;
import com.steve.creact.processor.core.Logger;
import com.steve.creact.processor.core.model.AbstractModel;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Writer;
import java.util.HashMap;
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;
        logger.log(Diagnostic.Kind.NOTE, "create source file...");
        JavaFileObject jfo = createFile();
        if (jfo == null) {
            logger.log(Diagnostic.Kind.NOTE, "create java file failed,aborted");
            return;
        }
        //write file
        logger.log(Diagnostic.Kind.NOTE, "write source file...");
        try {
            writeFile(template, jfo.openWriter());
            String sourceFileName = getModelClassName();
            logger.log(Diagnostic.Kind.NOTE, "generate source file successful:" + sourceFileName);
        } catch (IOException e) {
            logger.log(Diagnostic.Kind.ERROR, "create file failed");
            e.printStackTrace();
        }
    }

    /**
     * Firstly,check whether template cache contains the target template,if not,
     * load template file into memory from resource directory.
     *
     * @return template content
     */
    protected String loadTemplate() {
        String result = "";
        String templateFilePath = getTemplateFilePath();
        //check cache first
        if (templateFilePath != null && (result = templateCache.get(templateFilePath)) != null)
            return result;
// Path: holder-compiler/src/main/java/com/steve/creact/processor/core/Constants.java
// public final class Constants {
//     private Constants(){}
// 
//     public static final String TEMPLATE_PATH = "templates/databean-source.tm";
//     public static final String PACKAGE_NAME = "${PACKAGE_NAME}";
//     public static final String DATA_ENTITY_FULL_QUALIFIED_CLASS_NAME = "${DATA_ENTITY_FULL_QUALIFIED_CLASS_NAME}";
//     public static final String VIEW_HOLDER_FULL_QUALIFIED_CLASS_NAME = "${VIEW_HOLDER_FULL_QUALIFIED_CLASS_NAME}";
//     public static final String VIEW_HOLDER_SIMPLE_CLASS_NAME = "${VIEW_HOLDER_SIMPLE_CLASS_NAME}";
//     public static final String DATA_BEAN_SIMPLE_CLASS_NAME = "${DATA_BEAN_SIMPLE_CLASS_NAME}";
//     public static final String DATA_ENTITY_SIMPLE_CLASS_NAME = "${DATA_ENTITY_SIMPLE_CLASS_NAME}";
// }
// 
// Path: holder-compiler/src/main/java/com/steve/creact/processor/core/Logger.java
// public class Logger {
//     public static boolean logOn = false;
//     public static Logger getInstance(Messager messager) {
//         if (instance == null) {
//             synchronized (Logger.class) {
//                 if (instance != null)
//                     return instance;
//                 instance = new Logger(messager);
//             }
//         }
//         return instance;
//     }
// 
//     private static Messager actual;
//     private static volatile Logger instance;
//     private Logger(Messager actual) {
//         this.actual = actual;
//     }
// 
//     public void log(Diagnostic.Kind kind, String message) {
//         if (logOn && actual != null) {
//             actual.printMessage(kind, message);
//         }
//     }
// }
// 
// Path: holder-compiler/src/main/java/com/steve/creact/processor/core/model/AbstractModel.java
// public abstract class AbstractModel<R> {
// 
//     protected Element element;
//     protected ElementVisitorAdapter elementVisitor;
//     /**
//      * real model
//      */
//     private R model;
// 
//     public AbstractModel(Element element) {
//         this.element = element;
//     }
// 
//     public boolean isClass() {
//         return element.getKind().isClass();
//     }
// 
//     public boolean isInterface() {
//         return element.getKind().isInterface();
//     }
// 
//     public boolean isField() {
// 
//         return element.getKind().isField();
//     }
// 
//     public String getSimpleName() {
//         return element.getSimpleName().toString();
//     }
// 
//     public <P> void visit(P p) {
//         model = (R) element.accept(this.elementVisitor, p);
//     }
// 
//     public <P> void setElementVisitor(ElementVisitorAdapter<R, P> visitor) {
//         this.elementVisitor = visitor;
//     }
// 
//     public R getRealModel() {
//         return model;
//     }
// 
// }


// Path: holder-compiler/src/main/java/com/steve/creact/processor/core/view/BaseViewGenerator.java
import com.steve.creact.processor.core.Constants;
import com.steve.creact.processor.core.Logger;
import com.steve.creact.processor.core.model.AbstractModel;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Writer;
import java.util.HashMap;
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;

        logger.log(Diagnostic.Kind.NOTE, "create source file...");
        JavaFileObject jfo = createFile();
        if (jfo == null) {
            logger.log(Diagnostic.Kind.NOTE, "create java file failed,aborted");
            return;
        }
        //write file
        logger.log(Diagnostic.Kind.NOTE, "write source file...");
        try {
            writeFile(template, jfo.openWriter());
            String sourceFileName = getModelClassName();
            logger.log(Diagnostic.Kind.NOTE, "generate source file successful:" + sourceFileName);
        } catch (IOException e) {
            logger.log(Diagnostic.Kind.ERROR, "create file failed");
            e.printStackTrace();
        }
    }

    /**
     * Firstly,check whether template cache contains the target template,if not,
     * load template file into memory from resource directory.
     *
     * @return template content
     */
    protected String loadTemplate() {
        String result = "";
        String templateFilePath = getTemplateFilePath();
        //check cache first
        if (templateFilePath != null && (result = templateCache.get(templateFilePath)) != null)
            return result;
        InputStream is = this.getClass().getClassLoader().getResourceAsStream(Constants.TEMPLATE_PATH);