Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rewe.exercise.bookstore.book;
- import com.rewe.exercise.bookstore.author.Author;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Objects;
- public class Book {
- private Long isbn;
- private String title;
- private String publisher;
- private int year;
- private double price;
- private int availableQuantity;
- private List<Author> authors = new ArrayList<>();
- public Long getIsbn() {
- return isbn;
- }
- void setIsbn(Long isbn) {
- this.isbn = isbn;
- }
- public String getTitle() {
- return title;
- }
- void setTitle(String title) {
- this.title = title;
- }
- public String getPublisher() {
- return publisher;
- }
- void setPublisher(String publisher) {
- this.publisher = publisher;
- }
- public int getYear() {
- return year;
- }
- void setYear(int year) {
- this.year = year;
- }
- public double getPrice() {
- return price;
- }
- void setPrice(double price) {
- this.price = price;
- }
- public int getAvailableQuantity() {
- return availableQuantity;
- }
- void setAvailableQuantity(int quantity) {
- availableQuantity = quantity;
- }
- List<Author> getAuthors() {
- return authors;
- }
- void setAuthors(List<Author> authors) {
- this.authors = authors;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Book book = (Book) o;
- return year == book.year &&
- Double.compare(book.price, price) == 0 &&
- Objects.equals(title, book.title) &&
- Objects.equals(publisher, book.publisher);
- }
- @Override
- public int hashCode() {
- return Objects.hash(title, publisher, year, price);
- }
- @Override
- public String toString() {
- return "Book{" +
- ", title='" + title + '\'' +
- ", publisher='" + publisher + '\'' +
- ", year=" + year +
- ", price=" + price +
- '}';
- }
- }
Add Comment
Please, Sign In to add comment