@@ -0,0 +1,1057 @@
+package com.github.SimonXianyu.codefather.freemarker;%0A%0Aimport com.github.SimonXianyu.codefather.model.Described;%0Aimport freemarker.ext.beans.BeanModel;%0Aimport freemarker.ext.beans.BeansWrapper;%0Aimport freemarker.template.SimpleHash;%0Aimport freemarker.template.TemplateModel;%0Aimport freemarker.template.TemplateModelException;%0A%0Aimport java.util.Map;%0A%0A/**%0A * Model to expose dynamic attribute in freemarker.%0A * Created by simon on 15/6/23.%0A */%0Apublic class BeanDynaAttrModel extends BeanModel %7B%0A  private SimpleHash attrMap;%0A%0A  public BeanDynaAttrModel(Object object, BeansWrapper wrapper) %7B%0A    super(object, wrapper);%0A    attrMap = new SimpleHash();%0A    if (object instanceof Described) %7B%0A      for(Map.Entry%3CString, String%3E e : ((Described)object).getAttrMap().entrySet()) %7B%0A        attrMap.put(e.getKey(),e.getValue());%0A      %7D%0A    %7D%0A  %7D%0A%0A  @Override%0A  public TemplateModel get(String key) throws TemplateModelException %7B%0A    TemplateModel result = super.get(key);%0A    if (null == result) %7B%0A      result = attrMap.get(key);%0A    %7D%0A    return result;%0A  %7D%0A%7D%0A

add BeanDynaAttrModel to simplify expose attributes