Class ProtectionAdapter
java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.pipeline.accessors.protection.ProtectionAdapter
- All Implemented Interfaces:
Accessor
An
Accessor implementation for adapting objects that implement the Protectable interface.
This adapter is responsible for identifying objects that expose a protection period via
a Instant (i.e., a protection expiration timestamp). If the provided object implements
Protectable, it is wrapped and returned as an Optional<Protectable>; otherwise,
an empty Optional is returned.
Once adapted, the object can be used to populate macro placeholders such as:
[OBJECT.PROTECTION.DURATION} – a localized string showing the remaining protection time[OBJECT.PROTECTION.INSTANT} – the formatted expiration date/time
These macros are generated using the Protectable.extractProtection(com.winterhavenmc.library.messagebuilder.models.keys.ValidMacroKey, java.time.temporal.ChronoUnit, java.time.format.FormatStyle, com.winterhavenmc.library.messagebuilder.core.context.AccessorCtx) method.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.winterhavenmc.library.messagebuilder.core.ports.pipeline.accessors.Accessor
Accessor.BuiltIn -
Field Summary
Fields inherited from interface com.winterhavenmc.library.messagebuilder.core.ports.pipeline.accessors.Accessor
UNKNOWN_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAttempts to adapt the given object to theProtectableinterface.
-
Constructor Details
-
ProtectionAdapter
public ProtectionAdapter()
-
-
Method Details
-
adapt
Attempts to adapt the given object to theProtectableinterface.
-