FlexJson Transformer 集合成员问题

public class Menu extends AbstractModel<Menu> {

       private static final long serialVersionUID = 8005065748747566324L;

       private Long id;

       private String menuName;

       private String menuUrl;

       private Long parentId;

       private Long privilegeCode;

       private Integer privilegePos;

       private String description;

       private List<Menu> children;  // 注意是该类集合

       private String parentName; 

}

需要把children中的字段格式化输出:

js.transform(new Transformer() {

         public void transform(Object object) {

                System.out.println(object);

                JSONContext.get().write("\"" + object.toString() + "\"");

         }

}, "id",  "children.id"); // 成员集合字段 点 字段名

猜你喜欢

转载自niebinxiao.iteye.com/blog/2196852