Result.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.goafanti.common.bo;
  2. import java.io.Serializable;
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. public class Result {
  6. private Object data;
  7. private List<Error> error = new ArrayList<Error>();
  8. private Serializable token;
  9. public Result() {
  10. /*if(TokenManager.isLogin())
  11. this.token = SecurityUtils.getSubject().getSession().getId();*/
  12. }
  13. public Result(Object data) {
  14. this.data = data;
  15. }
  16. /**
  17. * @return the data
  18. */
  19. public Object getData() {
  20. return data;
  21. }
  22. /**
  23. * @param data
  24. * the data to set
  25. */
  26. public void setData(Object data) {
  27. this.data = data;
  28. }
  29. /**
  30. * @return the error
  31. */
  32. public List<Error> getError() {
  33. return error;
  34. }
  35. /**
  36. * @param error
  37. * the error to set
  38. */
  39. public void setError(List<Error> error) {
  40. this.error = error;
  41. }
  42. public Result error(Error e) {
  43. if (e != null) {
  44. this.error.add(e);
  45. }
  46. return this;
  47. }
  48. public Result data(Object o) {
  49. this.data = o;
  50. return this;
  51. }
  52. public Serializable getToken() {
  53. return token;
  54. }
  55. public void setToken(Serializable token) {
  56. this.token = token;
  57. }
  58. }