Skip to content

feat(api): Add pages-only constructor to BookImpl#1372

Open
Privatech38 wants to merge 1 commit intoPaperMC:main/5from
Privatech38:feat/book-author
Open

feat(api): Add pages-only constructor to BookImpl#1372
Privatech38 wants to merge 1 commit intoPaperMC:main/5from
Privatech38:feat/book-author

Conversation

@Privatech38
Copy link
Contributor

Closes #1348

@Privatech38 Privatech38 changed the title feat: Add pages-only constructor to BookImpl feat(api): Add pages-only constructor to BookImpl Feb 18, 2026
@kezz
Copy link
Member

kezz commented Feb 18, 2026

This is useless without an associated change to the book interface

@Privatech38
Copy link
Contributor Author

@kezz implemeted the creation methods

@kezz kezz self-assigned this Feb 19, 2026
@kezz kezz modified the milestones: 5.0.0, 5.1.0 Feb 19, 2026
fix: BookImpl's pages constructor not being final

feat: Add pages-only creation methods to Books API

feat: Add pages-only constructor
* @since 5.1.0
*/
static Book book(final Collection<Component> pages) {
return new BookImpl(new ArrayList<>(pages));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return new BookImpl(new ArrayList<>(pages));
return new BookImpl(List.copyOf(pages));

Copy link
Contributor Author

@Privatech38 Privatech38 Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that would differ from the implementation that uses title and author?

static Book book(final Component title, final Component author, final Collection<Component> pages) {
return new BookImpl(title, author, new ArrayList<>(pages));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Book author and title should be optional

3 participants