Class ConcreteReusable

java.lang.Object
Creational.ObjectPool.ConcreteReusable
All Implemented Interfaces:
Reusable

public class ConcreteReusable extends Object implements Reusable
Concrete implementation of the Reusable interface. Simulates a reusable object with a unique identifier and an "in-use" state.
  • Constructor Details

    • ConcreteReusable

      public ConcreteReusable(String id)
      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: Reusable
      Performs 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."
      Specified by:
      use in interface Reusable
    • reset

      public void reset()
      Description copied from interface: Reusable
      Resets 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.
      Specified by:
      reset in interface Reusable
    • toString

      public String toString()
      Overrides:
      toString in class Object