Result.java 1.2 KB

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