Package com.esprit.models.products
Class SharedData
java.lang.Object
com.esprit.models.products.SharedData
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor to prevent direct instantiation of the class. -
Method Summary
Modifier and TypeMethodDescriptionstatic SharedData
Returns the instance of the SharedData class.
-
Field Details
-
instance
-
totalPrice
private double totalPrice
-
-
Constructor Details
-
SharedData
private SharedData()Private constructor to prevent direct instantiation of the class.
-
-
Method Details
-
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.
-