Package win.dailypickle.report.model
Record Class Attachment
java.lang.Object
java.lang.Record
win.dailypickle.report.model.Attachment
- Record Components:
name- the display name passed toscenario.attach(data, mediaType, name), ornullwhen the caller did not provide one (reports fall back to the MIME type)mimeType- the MIME type declared at attach time (e.g."image/png","application/json","text/plain")data- Base64-encoded attachment content, ornullwhen the attachment is externalpath- path of the attachment file relative to the report directory, ornullwhen the attachment is inlinesizeBytes- size of the raw (un-encoded) payload in bytes
public record Attachment(String name, String mimeType, String data, String path, long sizeBytes)
extends Record
An attachment captured from a
scenario.attach() call during step or hook execution.
Attachments are stored in one of two ways, decided at capture time by the payload size:
- Inline — payloads up to the configured inline limit (default 4 KiB, see
dailypickle.attachments.inlineLimit) are Base64-encoded intodata;pathisnull. Binary payloads (e.g. screenshots) are encoded directly; text payloads are UTF-8–encoded then Base64-encoded. - External — larger payloads are streamed to a file next to the report as soon as they
are attached, so they never accumulate on the heap.
pathholds the file's location relative to the report directory (forward slashes);dataisnull.
The HTML report embeds every attachment so the single file stays portable: inline images and
text render directly (with syntax highlighting), external payloads are re-streamed from disk into
the document at generation time (images as data: URIs, text as plain code blocks, other
types as data: URI download links). The Markdown report includes only LLM-readable MIME
types (text/* except text/html, application/json,
application/xml, application/yaml), reading small external files back from disk.
Note: scenario.log() output is not captured — use scenario.attach()
with a text MIME type instead.
-
Constructor Summary
ConstructorsConstructorDescriptionAttachment(String name, String mimeType, String data, String path, long sizeBytes) Creates an instance of aAttachmentrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondata()Returns the value of thedatarecord component.Name when provided, MIME type otherwise — what reports show as the attachment's label.final booleanIndicates whether some other object is "equal to" this one.static AttachmentCreates an external attachment stored on disk atpathrelative to the report dir.final inthashCode()Returns a hash code value for this object.static AttachmentCreates an inline attachment whose Base64 content is carried in the report model.booleanTrue when the payload lives on disk rather than in the report model.mimeType()Returns the value of themimeTyperecord component.name()Returns the value of thenamerecord component.path()Returns the value of thepathrecord component.longReturns the value of thesizeBytesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Attachment
Creates an instance of aAttachmentrecord class.
-
-
Method Details
-
inline
Creates an inline attachment whose Base64 content is carried in the report model. -
external
Creates an external attachment stored on disk atpathrelative to the report dir. -
isExternal
public boolean isExternal()True when the payload lives on disk rather than in the report model. -
displayName
Name when provided, MIME type otherwise — what reports show as the attachment's label. -
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 '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
mimeType
Returns the value of themimeTyperecord component.- Returns:
- the value of the
mimeTyperecord component
-
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
sizeBytes
public long sizeBytes()Returns the value of thesizeBytesrecord component.- Returns:
- the value of the
sizeBytesrecord component
-