PageRenderTime 49ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/java/com/linbox/im/message/PullOldMsgRequestType.java

https://gitlab.com/Mr.Tomato/linbox_server
Java | 54 lines | 33 code | 15 blank | 6 comment | 0 complexity | e29aad0cc8ac4ad4612c14e5d66565bb MD5 | raw file
  1. package com.linbox.im.message;
  2. /**
  3. * Created by lrsec on 8/4/15.
  4. */
  5. import com.alibaba.fastjson.JSON;
  6. /**
  7. * 冗余类型,仅用于简化客户端操作
  8. */
  9. public enum PullOldMsgRequestType {
  10. LATEST(1, "最新数据"),
  11. OLD(2, "历史数据"),
  12. POINTED(3,"指定数据")
  13. ;
  14. private int value;
  15. private String name;
  16. private PullOldMsgRequestType(int value, String name) {
  17. this.value = value;
  18. this.name = name;
  19. }
  20. public int getValue() {
  21. return value;
  22. }
  23. public String getName() {
  24. return name;
  25. }
  26. public int valueOf() {
  27. return value;
  28. }
  29. public static void main(String[] args) {
  30. class A {
  31. public PullOldMsgRequestType type = LATEST;
  32. }
  33. A a = new A();
  34. String json = JSON.toJSONString(a);
  35. A b = JSON.parseObject(json, A.class);
  36. System.out.println(json);
  37. System.out.println(b.type.getName());
  38. }
  39. }