SpringBootLibrary
Loading...
Searching...
No Matches
com.example.restapi.model.Borrowing Class Reference

A JPA entity representing a borrowing record. More...

Public Member Functions

 Borrowing ()
 Default constructor.
 Borrowing (User user, Book book)
 Constructor to create a new borrowing record.
Long getId ()
 Gets the unique identifier of the borrowing record.
User getUser ()
 Gets the user associated with this borrowing.
Book getBook ()
 Gets the book associated with this borrowing.
LocalDateTime getBorrowDate ()
 Gets the date and time when the book was borrowed.
LocalDateTime getReturnDate ()
 Gets the date and time when the book was returned.
void setReturnDate (LocalDateTime returnDate)
 Sets the date and time when the book was returned.

Detailed Description

A JPA entity representing a borrowing record.

This entity manages information regarding the borrowing and returning of a Book by a User.

Definition at line 31 of file Borrowing.java.

Constructor & Destructor Documentation

◆ Borrowing() [1/2]

com.example.restapi.model.Borrowing.Borrowing ( )

Default constructor.

Required by JPA for entity instantiation.

Definition at line 77 of file Borrowing.java.

◆ Borrowing() [2/2]

com.example.restapi.model.Borrowing.Borrowing ( User user,
Book book )

Constructor to create a new borrowing record.

Parameters
userthe user borrowing the book
bookthe book being borrowed

The borrow date is initialized to the current time, and the return date is set to null.

Definition at line 88 of file Borrowing.java.

Member Function Documentation

◆ getBook()

Book com.example.restapi.model.Borrowing.getBook ( )

Gets the book associated with this borrowing.

Returns
the Book that was borrowed

Definition at line 114 of file Borrowing.java.

◆ getBorrowDate()

LocalDateTime com.example.restapi.model.Borrowing.getBorrowDate ( )

Gets the date and time when the book was borrowed.

Returns
the borrow date and time

Definition at line 121 of file Borrowing.java.

◆ getId()

Long com.example.restapi.model.Borrowing.getId ( )

Gets the unique identifier of the borrowing record.

Returns
the borrowing record ID

Definition at line 100 of file Borrowing.java.

◆ getReturnDate()

LocalDateTime com.example.restapi.model.Borrowing.getReturnDate ( )

Gets the date and time when the book was returned.

Returns
the return date and time, or null if not yet returned

Definition at line 128 of file Borrowing.java.

◆ getUser()

User com.example.restapi.model.Borrowing.getUser ( )

Gets the user associated with this borrowing.

Returns
the User who borrowed the book

Definition at line 107 of file Borrowing.java.

◆ setReturnDate()

void com.example.restapi.model.Borrowing.setReturnDate ( LocalDateTime returnDate)

Sets the date and time when the book was returned.

Parameters
returnDatethe return date and time

Definition at line 135 of file Borrowing.java.


The documentation for this class was generated from the following file: