Record Class EmailFlags
java.lang.Object
java.lang.Record
cloud.opencode.base.email.EmailFlags
public record EmailFlags(boolean seen, boolean answered, boolean flagged, boolean deleted, boolean draft, boolean recent)
extends Record
Email Flags Record
邮件标记记录
Immutable record representing email status flags.
表示邮件状态标记的不可变记录。
Features | 主要功能:
- Read/unread status - 已读/未读状态
- Answered status - 已回复状态
- Flagged/starred status - 标记/星标状态
- Deleted status - 已删除状态
- Draft status - 草稿状态
- Recent status - 最近状态
Usage Examples | 使用示例:
// Check if email is unread
if (!email.flags().seen()) {
processNewEmail(email);
}
// Check if email is flagged/starred
if (email.flags().flagged()) {
highlightEmail(email);
}
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Since:
- JDK 25, opencode-base-email V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EmailFlagsDefault flags for a read email 已读邮件的默认标记static final EmailFlagsDefault flags for a new unread email 新未读邮件的默认标记 -
Constructor Summary
ConstructorsConstructorDescriptionEmailFlags(boolean seen, boolean answered, boolean flagged, boolean deleted, boolean draft, boolean recent) Creates an instance of aEmailFlagsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleananswered()Returns the value of theansweredrecord component.booleandeleted()Returns the value of thedeletedrecord component.booleandraft()Returns the value of thedraftrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanflagged()Returns the value of theflaggedrecord component.static EmailFlagsfromImapFlags(String imapFlags) Create flags from IMAP flags string 从IMAP标记字符串创建标记final inthashCode()Returns a hash code value for this object.booleanisUnread()Check if email is unread 检查邮件是否未读booleanrecent()Returns the value of therecentrecord component.booleanseen()Returns the value of theseenrecord component.Convert to IMAP flags string 转换为IMAP标记字符串final StringtoString()Returns a string representation of this record class.withAnswered(boolean answered) Create a copy with answered flag set 创建设置已回复标记的副本withDeleted(boolean deleted) Create a copy with deleted flag set 创建设置删除标记的副本withFlagged(boolean flagged) Create a copy with flagged status set 创建设置标记状态的副本withSeen(boolean seen) Create a copy with seen flag set 创建设置已读标记的副本
-
Field Details
-
UNREAD
Default flags for a new unread email 新未读邮件的默认标记 -
READ
Default flags for a read email 已读邮件的默认标记
-
-
Constructor Details
-
EmailFlags
public EmailFlags(boolean seen, boolean answered, boolean flagged, boolean deleted, boolean draft, boolean recent) Creates an instance of aEmailFlagsrecord class.- Parameters:
seen- the value for theseenrecord componentanswered- the value for theansweredrecord componentflagged- the value for theflaggedrecord componentdeleted- the value for thedeletedrecord componentdraft- the value for thedraftrecord componentrecent- the value for therecentrecord component
-
-
Method Details
-
fromImapFlags
Create flags from IMAP flags string 从IMAP标记字符串创建标记Parses an IMAP FLAGS response string like "(\\Seen \\Flagged \\Answered)"
解析IMAP FLAGS响应字符串,如 "(\\Seen \\Flagged \\Answered)"
- Parameters:
imapFlags- the IMAP flags string (e.g., "(\\Seen \\Flagged)") | IMAP标记字符串- Returns:
- the email flags | 邮件标记
-
toImapFlags
Convert to IMAP flags string 转换为IMAP标记字符串- Returns:
- the IMAP flags string (e.g., "(\\Seen \\Flagged)") | IMAP标记字符串
-
isUnread
public boolean isUnread()Check if email is unread 检查邮件是否未读- Returns:
- true if unread | 未读返回true
-
withSeen
Create a copy with seen flag set 创建设置已读标记的副本- Parameters:
seen- the seen flag | 已读标记- Returns:
- new flags with updated seen status | 更新已读状态后的新标记
-
withFlagged
Create a copy with flagged status set 创建设置标记状态的副本- Parameters:
flagged- the flagged status | 标记状态- Returns:
- new flags with updated flagged status | 更新标记状态后的新标记
-
withDeleted
Create a copy with deleted flag set 创建设置删除标记的副本- Parameters:
deleted- the deleted flag | 删除标记- Returns:
- new flags with updated deleted status | 更新删除状态后的新标记
-
withAnswered
Create a copy with answered flag set 创建设置已回复标记的副本- Parameters:
answered- the answered flag | 已回复标记- Returns:
- new flags with updated answered status | 更新已回复状态后的新标记
-
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 with thecomparemethod from their corresponding wrapper classes. -
seen
public boolean seen()Returns the value of theseenrecord component.- Returns:
- the value of the
seenrecord component
-
answered
public boolean answered()Returns the value of theansweredrecord component.- Returns:
- the value of the
answeredrecord component
-
flagged
public boolean flagged()Returns the value of theflaggedrecord component.- Returns:
- the value of the
flaggedrecord component
-
deleted
public boolean deleted()Returns the value of thedeletedrecord component.- Returns:
- the value of the
deletedrecord component
-
draft
public boolean draft()Returns the value of thedraftrecord component.- Returns:
- the value of the
draftrecord component
-
recent
public boolean recent()Returns the value of therecentrecord component.- Returns:
- the value of the
recentrecord component
-