Package DatabaseItems
Class InventoryRequest
java.lang.Object
DatabaseItems.InventoryRequest
- All Implemented Interfaces:
DatabaseItems
The
InventoryRequest
class represents a request for inventory items.
It implements the DatabaseItems
interface and provides methods for
serialization, deserialization, and displaying request details.-
Constructor Summary
ConstructorsConstructorDescriptionInventoryRequest
(String... params) Constructs anInventoryRequest
instance by deserializing from an array of parameters.InventoryRequest
(String medicine, int request_value) Constructs anInventoryRequest
instance with specified medicine name and request value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deserialise
(String... params) Deserializes parameters into anInventoryRequest
object.Returns the name of the requested medicine.int
Returns the quantity requested for the medicine.void
Prints details of the inventory request to the console.Serializes theInventoryRequest
object into a CSV format string.void
setMedicine
(String medicine) Sets a new name for the requested medicine.void
setRequestValue
(int request_value) Sets a new request value for the quantity of requested medicine.
-
Constructor Details
-
InventoryRequest
Constructs anInventoryRequest
instance with specified medicine name and request value.- Parameters:
medicine
- the name of the requested medicinerequest_value
- the quantity of the requested medicine
-
InventoryRequest
Constructs anInventoryRequest
instance by deserializing from an array of parameters.- Parameters:
params
- an array of strings containing serialized data for the inventory request
-
-
Method Details
-
deserialise
Deserializes parameters into anInventoryRequest
object.- Specified by:
deserialise
in interfaceDatabaseItems
- Parameters:
params
- an array of strings containing serialized data for the inventory request
-
serialise
Serializes theInventoryRequest
object into a CSV format string.- Specified by:
serialise
in interfaceDatabaseItems
- Returns:
- a string representing the serialized data of the inventory request
-
printItem
public void printItem()Prints details of the inventory request to the console.- Specified by:
printItem
in interfaceDatabaseItems
-
getMedicine
Returns the name of the requested medicine.- Returns:
- the name of the medicine
-
getRequestValue
public int getRequestValue()Returns the quantity requested for the medicine.- Returns:
- the requested quantity
-
setMedicine
Sets a new name for the requested medicine.- Parameters:
medicine
- the new name of the requested medicine
-
setRequestValue
public void setRequestValue(int request_value) Sets a new request value for the quantity of requested medicine.- Parameters:
request_value
- the new quantity to set
-