PageRenderTime 5416ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/src/com/jieshuhuiyou/entity/notifications/AbstractNotification.java

https://bitbucket.org/psjay/ants-bookbase
Java | 48 lines | 19 code | 9 blank | 20 comment | 0 complexity | 1a36f728e085a1dda110926b70024e76 MD5 | raw file
  1. package com.jieshuhuiyou.entity.notifications;
  2. import java.util.Date;
  3. import com.alibaba.fastjson.JSON;
  4. import com.jieshuhuiyou.entity.Notification;
  5. import com.jieshuhuiyou.entity.User;
  6. import com.jieshuhuiyou.entity.Notification.Type;
  7. /**
  8. * ?????
  9. * @author PSJay
  10. */
  11. public abstract class AbstractNotification {
  12. /**
  13. * ????? Notification ??
  14. * @return ?????
  15. */
  16. public Notification toNotificationEntity() {
  17. Notification notification = new Notification();
  18. notification.setType(getType());
  19. notification.setUser(getOwner());
  20. notification.setDate(new Date());
  21. notification.setJsonContent(JSON.toJSONString(this));
  22. return notification;
  23. }
  24. /**
  25. * ?? HTML ??
  26. * @return
  27. */
  28. public abstract String toHTML();
  29. /**
  30. * ????????
  31. * @return
  32. */
  33. public abstract User getOwner();
  34. /**
  35. * ???????
  36. * @return
  37. */
  38. public abstract Type getType();
  39. }