Package openbook.domain
Class Book
- java.lang.Object
-
- openbook.domain.Book
-
- All Implemented Interfaces:
java.io.Serializable
@Entity public class Book extends java.lang.Object implements java.io.Serializable
An immutable persistent entity represents a Book.
The mutable properties of the book such as number of items in stock etc. are factored out in a separateInventory
instance.
The state of inventory is mutable, but the relation to inventory is immutable.- Identity: Application-defined identity.
- Mapping: One-to-One bi-directional, immutable mapping to
Inventory
. Many-to-Many bi-directional mapping to Author.- Version: No.
- Author:
- Pinaki Poddar
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAuthor(Author... authors)
boolean
equals(java.lang.Object obj)
java.util.List<Author>
getAuthors()
Inventory
getInventory()
java.lang.String
getISBN()
double
getPrice()
java.lang.String
getTitle()
int
getVersion()
int
hashCode()
void
setAuthors(java.util.List<Author> authors)
-
-
-
Constructor Detail
-
Book
public Book()
A no-arg constructor is required for JPA Specification.
-
Book
public Book(java.lang.String ISBN, java.lang.String title, double price, int initialSupply)
Construct a book with given parameters.- Parameters:
ISBN
- primary identity of this Booktitle
- Title of the book.price
- price of the book.initialSupply
- initial inventory quantity.
-
-
Method Detail
-
getISBN
public java.lang.String getISBN()
-
getTitle
public java.lang.String getTitle()
-
getPrice
public double getPrice()
-
getAuthors
public java.util.List<Author> getAuthors()
-
addAuthor
public void addAuthor(Author... authors)
-
setAuthors
public void setAuthors(java.util.List<Author> authors)
-
getInventory
public Inventory getInventory()
-
getVersion
public int getVersion()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-