Peter Johnson wrote:You could find forgiveness for your sins if you would post the solution...
![]()
java.lang.NoSuchMethodError: <MyTagClass>.setValue(Ljava/util/Date;)V
Originally posted by Eric Nielsen:
Other possible refinements...
a) introduce a "LoanedBook" class that holds a Book, a Customer, and the return date, customer to it. Convert the book to a purely immutable class. Now Book is perfectly safe to return to any client code... You won't be able to ask a Book who has it -- you'll have to see "for this book, is there a checkout, if so, who has it?"
b) the constructor for LoanedBook, or the factory method returning a LoanedBook, would now contain all the logic about when a checkout is allowed, and what duration to set for the return. To me this would seem much cleaner than embedding that within the book, and the customer.