/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
- package com.jieshuhuiyou.entity.notifications;
- import java.util.Date;
- import com.alibaba.fastjson.JSON;
- import com.jieshuhuiyou.entity.Notification;
- import com.jieshuhuiyou.entity.User;
- import com.jieshuhuiyou.entity.Notification.Type;
- /**
- * ?????
- * @author PSJay
- */
- public abstract class AbstractNotification {
-
- /**
- * ????? Notification ??
- * @return ?????
- */
- public Notification toNotificationEntity() {
- Notification notification = new Notification();
- notification.setType(getType());
- notification.setUser(getOwner());
- notification.setDate(new Date());
- notification.setJsonContent(JSON.toJSONString(this));
-
- return notification;
- }
-
- /**
- * ?? HTML ??
- * @return
- */
- public abstract String toHTML();
-
- /**
- * ????????
- * @return
- */
- public abstract User getOwner();
-
- /**
- * ???????
- * @return
- */
- public abstract Type getType();
-
- }