@@ -0,0 +1,2251 @@
+package com.lfkdsk.justel.template;%0A%0Aimport com.lfkdsk.justel.context.JustMapContext;%0Aimport com.lfkdsk.justel.template.dom.DomCom;%0Aimport org.junit.jupiter.api.Test;%0A%0A/**%0A * Created by liufengkai on 2017/7/25.%0A */%0Aclass TemplateImplTest %7B%0A    @Test%0A    void generateTemplate() %7B%0A        JustMapContext context = new JustMapContext();%0A        context.put(%22$%7Battrs%7D%22, %22@Override%22);%0A        context.put(%22$%7BclassName%7D%22, %22FakeName%22);%0A        context.put(%22$%7BlocalVars%7D%22, %22int i = 10;%22);%0A        context.put(%22$%7Bexpression%7D%22, %220;%22);%0A%0A        DomCom templateGen = new TemplateImpl().generateTemplate();%0A%0A        for (int j = 0; j %3C 20; j++) %7B%0A            long start = System.currentTimeMillis();%0A            for (int i = 0; i %3C 100 * 100; i++) %7B%0A                templateGen.fakeGenerateString(context);%0A            %7D%0A            long end = System.currentTimeMillis();%0A            System.out.println(end - start);%0A        %7D%0A    %7D%0A%0A    @Test%0A    void generateWithStringReplace() %7B%0A        String template = %22package com.greenpineyu.fel.compile;%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22import com.greenpineyu.fel.common.*;%5Cn%22 +%0A                %22import com.greenpineyu.fel.Expression;%5Cn%22 +%0A                %22import com.greenpineyu.fel.context.*;%5Cn%22 +%0A                %22//import org.apache.commons.lang3.ObjectUtils;%5Cn%22 +%0A                %22//import org.apache.commons.lang3.StringUtils;%5Cn%22 +%0A                %22%5Cn%22 +%0A                %22public class $%7Bclassname%7D implements Expression %7B%5Cn%22 +%0A                %22    $%7Battrs%7D%5Cn%22 +%0A                %22    public Object eval(FelContext context) %7B%5Cn%22 +%0A                %22        $%7BlocalVars%7D%5Cn%22 +%0A                %22        return $%7Bexpression%7D;%5Cn%22 +%0A                %22    %7D%5Cn%22 +%0A                %22%7D%5Cn%22;%0A        for (int j = 0; j %3C 20; j++) %7B%0A            long start = System.currentTimeMillis();%0A            for (int i = 0; i %3C 100 * 100; i++) %7B%0A                String src = template;%0A                src = StringUtils.replace(src, %22$%7Battrs%7D%22, %22lfkdsk%22);%0A                src = StringUtils.replace(src, %22$%7BlocalVars%7D%22, %22lfkdsk%22);%0A                src = StringUtils.replace(src, %22$%7Bexpression%7D%22, %22lfkdsk%22);%0A            %7D%0A            long end = System.currentTimeMillis();%0A            System.out.println(end - start);%0A        %7D%0A    %7D%0A%7D

add template test