public void create(Map data, String savePath, String className,String templateName) throws IOException {
        log.info(String.format("create class %s from template %s,save to %s",className,templateName,savePath));
        Template template = cfg.getTemplate(templateName);
        JavaClassNameParser parser = new JavaClassNameParser(className);

        String realFileName = savePath + File.separator+parser.getPackagePath() + parser.getJavaFileName();

        File file = new File(realFileName);
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }
        PrintWriter out = null;
        try {
            out = new PrintWriter(realFileName,Config.getEncoding());
            template.process(data, out);
        } catch (Exception e) {
            log.error(e);
        }finally {
            if(out != null){
                out.close();
            }
        }
    }