Skip to content

Snack 3.2.73

Compare
Choose a tag to compare
@noear noear released this 25 Jul 01:09
· 149 commits to master since this release
  • 增加 结构型枚举自定义字段序列化支持
public enum BookType {
    NOVEL(2,"小说"),
    CLASSICS(3,"名著"),
    ;

    //现在加了支持这个
    @ONodeAttr public final int code; //使用 code 做为序列化的字段
    public final String des;
    BookType(int code, String des){this.code=code; this.des=des;}
}

//原来只支持这个
public class Book {
    String name;
    BookType type;
    @ONodeAttr(serialize=false) String author; //不序列化
    @ONodeAttr(format="yyyy-MM-dd") Date releaseTime; //格式化时间输出
}