Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.demo.model;
- import org.springframework.data.annotation.Id;
- import org.springframework.data.mongodb.core.mapping.Document;
- import javax.validation.constraints.NotBlank;
- import javax.validation.constraints.NotNull;
- import java.time.LocalDate;
- @Document(collection = "books")
- public class Book {
- @Id
- private String isbn;
- @NotBlank
- private String title;
- @NotNull
- LocalDate publicationDate;
- public String getIsbn() {
- return isbn;
- }
- public void setIsbn(String isbn) {
- this.isbn = isbn;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public LocalDate getPublicationDate() {
- return publicationDate;
- }
- public void setPublicationDate(LocalDate publicationDate) {
- this.publicationDate = publicationDate;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Book book = (Book) o;
- return isbn != null ? isbn.equals(book.isbn) : book.isbn == null;
- }
- @Override
- public int hashCode() {
- return isbn != null ? isbn.hashCode() : 0;
- }
- }
Add Comment
Please, Sign In to add comment