Package Creational.ObjectPool
Class ConcreteReusable
java.lang.Object
Creational.ObjectPool.ConcreteReusable
- All Implemented Interfaces:
Reusable
Concrete implementation of the Reusable interface.
Simulates a reusable object with a unique identifier and an "in-use" state.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor initializing the object with a unique ID. -
Method Summary
-
Constructor Details
-
ConcreteReusable
Constructor initializing the object with a unique ID.- Parameters:
id- The unique identifier for the object.
-
-
Method Details
-
use
public void use()Description copied from interface:ReusablePerforms the primary action of the reusable object. This method simulates the usage of the object. Classes implementing this interface can define the specific behavior when the object is "used." -
reset
public void reset()Description copied from interface:ReusableResets the reusable object to its initial state. This method is invoked when the object is returned to the pool, ensuring that it is ready for reuse. Classes implementing this interface must define how their internal state is cleared or reinitialized. -
toString
-