Package net.paulem.arcana.hook
Class Hook<H,K>
java.lang.Object
net.paulem.arcana.hook.Hook<H,K>
- Type Parameters:
H- the type of the object returned by the hook once resolvedK- the type of the key used to select which supplier to resolve the hook from
Base class for hooks resolving an optional third-party implementation of type
H, chosen based on
a key of type K (typically derived from what's currently available on the server), through a
HookCondition mapping keys to lazy suppliers of the implementation.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Hook
Creates a new Hook.- Parameters:
api- the ArcanaAPI instance this hook belongs tohooks- the condition mapping keys to suppliers of the hooked implementation
-
-
Method Details
-
get
Resolves the hooked implementation for the key produced by the given supplier. If no supplier is registered for that key, this returnsnullrather than throwing.- Parameters:
supplier- supplies the key used to look up the registered hook supplier- Returns:
- the resolved implementation, or
nullif no hook is registered for the key
-