Interface Protectable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
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 Summary
Modifier and TypeMethodDescriptiondefault MacroStringMap
extractProtection
(MacroKey baseKey, ChronoUnit lowerBound, FormatStyle formatStyle, AdapterContextContainer ctx) Extracts protection-related fields from this object into aMacroStringMap
.Returns the protectionInstant
, representing the moment at which protection ends or expires.
-
Method Details
-
getProtection
Instant getProtection()Returns the protectionInstant
, 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 aMacroStringMap
. 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 tolowerBound
- the lowest time unit to include in the duration formattingformatStyle
- 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
-