Class SharedData

java.lang.Object
com.esprit.models.products.SharedData

public class SharedData extends Object
The SharedData class represents a shared data object that stores the total price. It follows the Singleton design pattern to ensure that only one instance of the class exists.
  • Field Details

    • instance

      private static SharedData instance
    • totalPrice

      private double totalPrice
  • Constructor Details

    • SharedData

      private SharedData()
      Private constructor to prevent direct instantiation of the class.
  • Method Details

    • getInstance

      public static SharedData getInstance()
      Returns the instance of the SharedData class. If the instance does not exist, a new instance is created.
      Returns:
      The instance of the SharedData class.