|
SpringBootLibrary
|
Public Member Functions | |
| List< Book > | getAllBooks () |
| Optional< Book > | getBookById (Long id) |
| Book | createBook (Book book) |
| Book | updateBook (Long id, Book bookDetails) throws Exception |
| void | deleteBook (Long id) |
| boolean | borrowBook (Long bookId, Long userId) |
| boolean | returnBook (Long bookId) |
Service class that provides business logic for managing Book and borrowing operations.
Definition at line 16 of file BookService.java.
| boolean com.example.restapi.service.BookService.borrowBook | ( | Long | bookId, |
| Long | userId ) |
Definition at line 80 of file BookService.java.
Creates a new book entry in the repository.
| book | the Book object to be created |
Book object Definition at line 50 of file BookService.java.
| void com.example.restapi.service.BookService.deleteBook | ( | Long | id | ) |
Deletes the Book identified by id. deleteBook() needs to be public because it is used by clients who wish to remove books identified by id
Definition at line 76 of file BookService.java.
| List< Book > com.example.restapi.service.BookService.getAllBooks | ( | ) |
Retrieves all books from the repository.
Book objects Definition at line 30 of file BookService.java.
| Optional< Book > com.example.restapi.service.BookService.getBookById | ( | Long | id | ) |
Retrieves a book by its unique identifier.
| id | the ID of the book to retrieve |
Definition at line 40 of file BookService.java.
| boolean com.example.restapi.service.BookService.returnBook | ( | Long | bookId | ) |
Returns a borrowed book, making it available for others.
| bookId | the ID of the book to return |
true if the return was successful, false otherwise Definition at line 100 of file BookService.java.
| Book com.example.restapi.service.BookService.updateBook | ( | Long | id, |
| Book | bookDetails ) throws Exception |
Updates an existing book's details.
| id | the ID of the book to update |
| bookDetails | the updated Book details |
Book object | Exception | if the book with the specified ID is not found |
Definition at line 63 of file BookService.java.