Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Book and Chapter classes are given below. They already have some fields defined, and your task is to use javax validation annotations to define constraints
Book and Chapter classes are given below. They already have some fields defined, and your task is to use javax validation annotations to define constraints on them.
Requirements
An instance of the Book class should pass javax validation only if:
the title is not empty;
Book has at least one chapter,
every chapter has a title that is not null, and each chapter's number of pages is greater than
;
Book has at least one, and at most three, authors; if the list of authors contains a null string, it should be considered invalid;
its ISBN number is a digit number;
both lastEditionPublishDate and firstEditionPubshDate are not null;
lastEditionPubshDate is not earlier than firstEditionPublishDate;
the sum of pages in all chapters is equal to the book's numberofPages
Bear in mind that the test cases that are used to score the solution run the javax validator only on Book instances. You should ensure that the validation of Book also involves the validation of all its
Chapter S
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started