2020-05-03 07:23
public class MultiSourceFactory implements ISourceFactory {
public ISource getSource(String baseTemplatePath, String fileName, String encoding) {
try{
return new ClassPathSource(null, fileName, encoding);
}catch(Exception ex){
return new FileSource(baseTemplatePath, fileName, encoding);
}
}
}
2019-05-10 17:06
<#function is_XXX_1 v>
<#return true />
<#function is_XXX_2 v>
<#return true />
<#function is_XXX_3 v>
<#return true />
<#if is_XXX_1(val) && is_XXX_2(val) && is_XXX_3(val)>
.....
象这样的代码,如果换成 #define 和 #set,不优雅啊(多出几个变量,页面多出空行输出,需额外调用)
#define is_XXX_1(1)
#set(v_XXX_1, true)
#end
#define is_XXX_2(1)
#set(v_XXX_2, true)
#end
#define is_XXX_3(1)
#set(v_XXX_3, true)
#end
#@is_XXX_1(val)
#@is_XXX_2(val)
#@is_XXX_3(val)
#if( v_XXX_1 && v_XXX_2 && v_XXX_3)
...
#end