Record Class Metadata
java.lang.Object
java.lang.Record
cloud.opencode.base.pdf.document.Metadata
- Record Components:
title- document title | 文档标题- document author | 文档作者subject- document subject | 文档主题keywords- document keywords | 文档关键词creator- creating application | 创建应用程序producer- PDF producer | PDF 生成器creationDate- creation date | 创建日期modDate- modification date | 修改日期
public record Metadata(String title, String author, String subject, List<String> keywords, String creator, String producer, Instant creationDate, Instant modDate)
extends Record
PDF Document Metadata - Document information dictionary
PDF 文档元数据 - 文档信息字典
Contains standard PDF metadata fields as defined in PDF specification.
包含 PDF 规范中定义的标准元数据字段。
Features | 主要功能:
- Standard PDF metadata fields (title, author, subject, keywords) - 标准 PDF 元数据字段(标题、作者、主题、关键词)
- Immutable record with builder support - 不可变记录,支持构建器
- Copy-with methods for updating fields - 用于更新字段的 with 方法
Usage Examples | 使用示例:
Metadata meta = Metadata.builder()
.title("My Document")
.author("John Doe")
.keywords("pdf", "document")
.build();
Metadata updated = meta.withTitle("New Title");
Security | 安全性:
- Thread-safe: Yes — immutable record - 线程安全: 是 — 不可变记录
- Null-safe: Partial — fields may be null - 空值安全: 部分 — 字段可能为空
- Since:
- JDK 25, opencode-base-pdf V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthor()Returns the value of theauthorrecord component.static Metadata.Builderbuilder()Creates a builder for metadata 创建元数据构建器Returns the value of thecreationDaterecord component.creator()Returns the value of thecreatorrecord component.static Metadataempty()Creates empty metadata 创建空的元数据final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.keywords()Returns the value of thekeywordsrecord component.modDate()Returns the value of themodDaterecord component.static MetadataCreates metadata with title only 仅创建带标题的元数据producer()Returns the value of theproducerrecord component.subject()Returns the value of thesubjectrecord component.title()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.withAuthor(String newAuthor) Creates a copy with updated author 创建更新作者后的副本Creates a copy with updated title 创建更新标题后的副本
-
Field Details
-
DEFAULT_PRODUCER
-
-
Constructor Details
-
Metadata
public Metadata(String title, String author, String subject, List<String> keywords, String creator, String producer, Instant creationDate, Instant modDate) Creates an instance of aMetadatarecord class.- Parameters:
title- the value for thetitlerecord componentauthor- the value for theauthorrecord componentsubject- the value for thesubjectrecord componentkeywords- the value for thekeywordsrecord componentcreator- the value for thecreatorrecord componentproducer- the value for theproducerrecord componentcreationDate- the value for thecreationDaterecord componentmodDate- the value for themodDaterecord component
-
-
Method Details
-
empty
-
ofTitle
-
builder
Creates a builder for metadata 创建元数据构建器- Returns:
- metadata builder | 元数据构建器
-
withTitle
-
withAuthor
-
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). -
title
-
author
-
subject
-
keywords
-
creator
-
producer
-
creationDate
Returns the value of thecreationDaterecord component.- Returns:
- the value of the
creationDaterecord component
-
modDate
-