Package DatabaseItems

Class InventoryRequest

java.lang.Object
DatabaseItems.InventoryRequest
All Implemented Interfaces:
DatabaseItems

public class InventoryRequest extends Object implements 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

    Constructors
    Constructor
    Description
    Constructs an InventoryRequest instance by deserializing from an array of parameters.
    InventoryRequest(String medicine, int request_value)
    Constructs an InventoryRequest instance with specified medicine name and request value.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deserialise(String... params)
    Deserializes parameters into an InventoryRequest 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 the InventoryRequest 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InventoryRequest

      public InventoryRequest(String medicine, int request_value)
      Constructs an InventoryRequest instance with specified medicine name and request value.
      Parameters:
      medicine - the name of the requested medicine
      request_value - the quantity of the requested medicine
    • InventoryRequest

      public InventoryRequest(String... params)
      Constructs an InventoryRequest instance by deserializing from an array of parameters.
      Parameters:
      params - an array of strings containing serialized data for the inventory request
  • Method Details

    • deserialise

      public void deserialise(String... params)
      Deserializes parameters into an InventoryRequest object.
      Specified by:
      deserialise in interface DatabaseItems
      Parameters:
      params - an array of strings containing serialized data for the inventory request
    • serialise

      public String serialise()
      Serializes the InventoryRequest object into a CSV format string.
      Specified by:
      serialise in interface DatabaseItems
      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 interface DatabaseItems
    • getMedicine

      public String 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

      public void setMedicine(String medicine)
      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