Record Class Recipient
java.lang.Object
java.lang.Record
io.leandev.appfuse.notification.Recipient
- Record Components:
userId- 使用者識別(最多 36 字元;供偏好查詢、稽核、IN_APP 投遞;可為 null)email- 電子郵件位址(EMAIL;最多 320 字元)phone- 手機號(SMS;最多 320 字元)lineUserId- LINE userId(LINE 推播;最多 320 字元)locale- 收件人語系(null 表示系統預設)
public record Recipient(String userId, String email, String phone, String lineUserId, Locale locale)
extends Record
通知收件人
由 RecipientResolver 從業務脈絡解析而得,或由呼叫端在 NotificationRequest 顯式提供。
框架不認得帳號模型——收件人以不透明的 userId 與各通道的收件位址表達。locale 供
NotificationTemplateResolver 在地化(null 表示系統預設語系)。
多通道定址:每個 ChannelType 對應一種位址——EMAIL→email、SMS→phone、LINE→lineUserId、
IN_APP→userId。addressFor(ChannelType) 依通道回對應位址;RecipientResolver 解析時填入該收件人各通道的位址
(沒有的留 null,NotificationService 會略過缺位址的通道)。
- Since:
- 4.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddressFor(ChannelType channel) 取此收件人在某通道的收件位址email()Returns the value of theemailrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelineUserIdrecord component.locale()Returns the value of thelocalerecord component.static Recipient以 email 建立收件人(無 userId、用系統預設語系)phone()Returns the value of thephonerecord component.final StringtoString()Returns a string representation of this record class.userId()Returns the value of theuserIdrecord component.
-
Constructor Details
-
Recipient
Creates an instance of aRecipientrecord class.- Parameters:
userId- the value for theuserIdrecord componentemail- the value for theemailrecord componentphone- the value for thephonerecord componentlineUserId- the value for thelineUserIdrecord componentlocale- the value for thelocalerecord component
-
-
Method Details
-
ofEmail
-
addressFor
取此收件人在某通道的收件位址- Parameters:
channel- 通道- Returns:
- 對應位址(無則 null)
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
userId
-
email
-
phone
-
lineUserId
Returns the value of thelineUserIdrecord component.- Returns:
- the value of the
lineUserIdrecord component
-
locale
-