Record Class Message
java.lang.Object
java.lang.Record
ch.martinelli.oss.testcontainers.mailpit.Message
public record Message(String id, String messageId, Address from, List<Address> to, List<Address> cc, List<Address> bcc, List<Address> replyTo, String subject, int size, Instant created, boolean read, com.fasterxml.jackson.databind.JsonNode attachmentsNode, String snippet, List<String> tags)
extends Record
Represents an email message from Mailpit.
This record handles both message summaries (from list endpoint) and detailed messages (from single message endpoint). The attachments field can be either an integer count (in summaries) or an array of attachment objects (in detailed view).
-
Constructor Summary
ConstructorsConstructorDescriptionMessage(String id, String messageId, Address from, List<Address> to, List<Address> cc, List<Address> bcc, List<Address> replyTo, String subject, int size, Instant created, boolean read, com.fasterxml.jackson.databind.JsonNode attachmentsNode, String snippet, List<String> tags) Creates an instance of aMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of attachments.com.fasterxml.jackson.databind.JsonNodeReturns the value of theattachmentsNoderecord component.bcc()Returns the value of thebccrecord component.cc()Returns the value of theccrecord component.created()Returns the value of thecreatedrecord component.final booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.Returns the value of themessageIdrecord component.booleanread()Returns the value of thereadrecord component.Returns the list of recipients as a convenience method.replyTo()Returns the value of thereplyTorecord component.intsize()Returns the value of thesizerecord component.snippet()Returns the value of thesnippetrecord component.subject()Returns the value of thesubjectrecord component.tags()Returns the value of thetagsrecord component.to()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Message
public Message(String id, String messageId, Address from, List<Address> to, List<Address> cc, List<Address> bcc, List<Address> replyTo, String subject, int size, Instant created, boolean read, com.fasterxml.jackson.databind.JsonNode attachmentsNode, String snippet, List<String> tags) Creates an instance of aMessagerecord class.- Parameters:
id- the value for theidrecord componentmessageId- the value for themessageIdrecord componentfrom- the value for thefromrecord componentto- the value for thetorecord componentcc- the value for theccrecord componentbcc- the value for thebccrecord componentreplyTo- the value for thereplyTorecord componentsubject- the value for thesubjectrecord componentsize- the value for thesizerecord componentcreated- the value for thecreatedrecord componentread- the value for thereadrecord componentattachmentsNode- the value for theattachmentsNoderecord componentsnippet- the value for thesnippetrecord componenttags- the value for thetagsrecord component
-
-
Method Details
-
attachmentCount
public int attachmentCount()Returns the number of attachments.- Returns:
- attachment count
-
recipients
Returns the list of recipients as a convenience method.- Returns:
- list of recipient addresses, never null
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
messageId
Returns the value of themessageIdrecord component.- Returns:
- the value of the
messageIdrecord component
-
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
to
Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-
cc
Returns the value of theccrecord component.- Returns:
- the value of the
ccrecord component
-
bcc
Returns the value of thebccrecord component.- Returns:
- the value of the
bccrecord component
-
replyTo
Returns the value of thereplyTorecord component.- Returns:
- the value of the
replyTorecord component
-
subject
Returns the value of thesubjectrecord component.- Returns:
- the value of the
subjectrecord component
-
size
public int size()Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-
created
Returns the value of thecreatedrecord component.- Returns:
- the value of the
createdrecord component
-
read
public boolean read()Returns the value of thereadrecord component.- Returns:
- the value of the
readrecord component
-
attachmentsNode
public com.fasterxml.jackson.databind.JsonNode attachmentsNode()Returns the value of theattachmentsNoderecord component.- Returns:
- the value of the
attachmentsNoderecord component
-
snippet
Returns the value of thesnippetrecord component.- Returns:
- the value of the
snippetrecord component
-
tags
Returns the value of thetagsrecord component.- Returns:
- the value of the
tagsrecord component
-