Record Class DocumentMetadata
java.lang.Object
java.lang.Record
ai.doctruth.DocumentMetadata
- Record Components:
sourceFilename- the original filename of the source document.pageCount- total number of pages in the source document;>= 1.sourcePublishedAt- UTC timestamp at which the source was authored, if known.
public record DocumentMetadata(String sourceFilename, int pageCount, Optional<Instant> sourcePublishedAt)
extends Record
Metadata for a
ParsedDocument: the source filename, total page count, and
(optionally) the timestamp at which the source document was authored / published.
Invariants (enforced by the compact constructor):
sourceFilenameis non-null and non-blank (any whitespace-only string rejected).pageCount >= 1.sourcePublishedAtis a non-nullOptional; passOptional.empty(), notnull, when unknown.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentMetadata(String sourceFilename, int pageCount, Optional<Instant> sourcePublishedAt) Creates an instance of aDocumentMetadatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thepageCountrecord component.Returns the value of thesourceFilenamerecord component.Returns the value of thesourcePublishedAtrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DocumentMetadata
Creates an instance of aDocumentMetadatarecord class.- Parameters:
sourceFilename- the value for thesourceFilenamerecord componentpageCount- the value for thepageCountrecord componentsourcePublishedAt- the value for thesourcePublishedAtrecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
sourceFilename
Returns the value of thesourceFilenamerecord component.- Returns:
- the value of the
sourceFilenamerecord component
-
pageCount
-
sourcePublishedAt
Returns the value of thesourcePublishedAtrecord component.- Returns:
- the value of the
sourcePublishedAtrecord component
-