Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Protectable
An interface representing objects that have a limited protection period, retrievable via an Instant timestamp.

Objects implementing this interface allow protection-related time values to be extracted and formatted for use in macro placeholder replacement, such as:

  • [OBJECT.PROTECTION.DURATION} – time remaining until protection expires
  • [OBJECT.PROTECTION.INSTANT} – the exact localized date/time when protection ends

These macros are automatically populated using this interface's extractProtection(...) method when objects are processed by the ProtectionAdapter.

  • Method Details

    • getProtection

      Instant getProtection()
      Returns the protection Instant, representing the moment at which protection ends or expires.
      Returns:
      the protection expiration timestamp
    • extractProtection

      default MacroStringMap extractProtection(MacroKey baseKey, ChronoUnit lowerBound, FormatStyle formatStyle, AdapterContextContainer ctx)
      Extracts protection-related fields from this object into a MacroStringMap. This includes both a localized duration until protection ends and a formatted date/time string.
      Parameters:
      baseKey - the macro base key this object is mapped to
      lowerBound - the lowest time unit to include in the duration formatting
      formatStyle - the desired style of date/time formatting (e.g. SHORT, MEDIUM)
      ctx - container for formatter dependencies and resolvers
      Returns:
      a MacroStringMap with entries for both duration and instant representations