Answered step by step
Verified Expert Solution
Link Copied!

Question

00
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
0;
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 13-digit number;
both lastEditionPublishDate and firstEditionPub11shDate are not null;
lastEditionPub11shDate 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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started