java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.adapters.expiration.ExpirationAdapter
All Implemented Interfaces:
Adapter

public class ExpirationAdapter extends Object implements Adapter
Adapter for objects that implement the Expirable interface.

This adapter allows eligible objects to be recognized as providing expiration-related data. If the provided object implements Expirable, it will be wrapped and returned for macro extraction of expiration-based values such as duration and timestamp.

Supports macro replacements such as:

  • [OBJECT.EXPIRATION.DURATION} – formatted time until expiration
  • [OBJECT.EXPIRATION.INSTANT} – formatted expiration date/time

This adapter is commonly used in time-sensitive contexts such as expiring items, events, cooldowns, or protection windows where expiration tracking is necessary.

  • Constructor Details

    • ExpirationAdapter

      public ExpirationAdapter()
  • Method Details

    • adapt

      public Optional<Expirable> adapt(Object obj)
      Attempts to adapt the given object into an Expirable, if applicable.
      Specified by:
      adapt in interface Adapter
      Parameters:
      obj - the object to be checked for adaptation
      Returns:
      an Optional containing the object as an Expirable, or empty if not supported