// Path: QuickProject-Util/src/main/java/chanedi/util/ReflectUtils.java
// public class ReflectUtils {
// 
//     public static PropertyDescriptor[] getBeanSetters(Class<?> type) {
//         return org.springframework.cglib.core.ReflectUtils.getBeanSetters(type);
//     }
// 
//     public static PropertyDescriptor[] getBeanGetters(Class<?> type) {
//         return org.springframework.cglib.core.ReflectUtils.getBeanGetters(type);
//     }
// 
//     public static Method getBeanGetter(Class<?> beanClass, String propertyName) throws IntrospectionException {
//         return new PropertyDescriptor(propertyName, beanClass).getReadMethod();
//     }
// 
//     public static Method getBeanSetter(Class<?> beanClass, String propertyName) throws IntrospectionException {
//         return new PropertyDescriptor(propertyName, beanClass).getWriteMethod();
//     }
// 
//     public static Field getFieldByGetter(Class<?> modelClass, String getterName) throws NoSuchFieldException {
//         String propName = org.apache.commons.lang3.StringUtils.uncapitalize(getterName.substring(3));
//         return modelClass.getDeclaredField(propName);
//     }
// 
//     public static Field getFieldBySetter(Class<?> modelClass, String setterName) throws NoSuchFieldException {
//         String propName = org.apache.commons.lang3.StringUtils.uncapitalize(setterName.substring(3));
//         return modelClass.getDeclaredField(propName);
//     }
// 
// }


import chanedi.util.ReflectUtils;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
package chanedi.generator.file;



/**
 * 非单例。
 * @author Chanedi
 */
@Data
public final class TemplateRootConfig {

    public static final String CONFIG_FILE_NAME = "config.properties";
    private static final Logger logger = LoggerFactory.getLogger(TemplateRootConfig.class);
    private String rootPath = "src";
    private String fileExtension = "java";

    private TemplateRootConfig() {
        super();
    }

    public static TemplateRootConfig getInstance(String path) throws IOException {
        Properties properties = new Properties();
        properties.load(new FileInputStream(path + "/" + CONFIG_FILE_NAME));

        TemplateRootConfig config = new TemplateRootConfig();

        Set<Map.Entry<Object, Object>> entrySet = properties.entrySet();
        for (Map.Entry<Object, Object> entry : entrySet) {
            String key = (String) entry.getKey();
            String value = (String) entry.getValue();
            Method setter = null;
            try {
// Path: QuickProject-Util/src/main/java/chanedi/util/ReflectUtils.java
// public class ReflectUtils {
// 
//     public static PropertyDescriptor[] getBeanSetters(Class<?> type) {
//         return org.springframework.cglib.core.ReflectUtils.getBeanSetters(type);
//     }
// 
//     public static PropertyDescriptor[] getBeanGetters(Class<?> type) {
//         return org.springframework.cglib.core.ReflectUtils.getBeanGetters(type);
//     }
// 
//     public static Method getBeanGetter(Class<?> beanClass, String propertyName) throws IntrospectionException {
//         return new PropertyDescriptor(propertyName, beanClass).getReadMethod();
//     }
// 
//     public static Method getBeanSetter(Class<?> beanClass, String propertyName) throws IntrospectionException {
//         return new PropertyDescriptor(propertyName, beanClass).getWriteMethod();
//     }
// 
//     public static Field getFieldByGetter(Class<?> modelClass, String getterName) throws NoSuchFieldException {
//         String propName = org.apache.commons.lang3.StringUtils.uncapitalize(getterName.substring(3));
//         return modelClass.getDeclaredField(propName);
//     }
// 
//     public static Field getFieldBySetter(Class<?> modelClass, String setterName) throws NoSuchFieldException {
//         String propName = org.apache.commons.lang3.StringUtils.uncapitalize(setterName.substring(3));
//         return modelClass.getDeclaredField(propName);
//     }
// 
// }


// Path: QuickProject-Generator/src/main/java/chanedi/generator/file/TemplateRootConfig.java
import chanedi.util.ReflectUtils;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

package chanedi.generator.file;



/**
 * 非单例。
 * @author Chanedi
 */
@Data
public final class TemplateRootConfig {

    public static final String CONFIG_FILE_NAME = "config.properties";
    private static final Logger logger = LoggerFactory.getLogger(TemplateRootConfig.class);
    private String rootPath = "src";
    private String fileExtension = "java";

    private TemplateRootConfig() {
        super();
    }

    public static TemplateRootConfig getInstance(String path) throws IOException {
        Properties properties = new Properties();
        properties.load(new FileInputStream(path + "/" + CONFIG_FILE_NAME));

        TemplateRootConfig config = new TemplateRootConfig();

        Set<Map.Entry<Object, Object>> entrySet = properties.entrySet();
        for (Map.Entry<Object, Object> entry : entrySet) {
            String key = (String) entry.getKey();
            String value = (String) entry.getValue();
            Method setter = null;
            try {
                setter = ReflectUtils.getBeanSetter(TemplateRootConfig.class, key);