-
-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event Context Calculators #2302
Comments
So, this is something along the lines that I'm thinking of: public interface EventManager {
<T, E extends Event> void registerCalculator(TypeToken<E> token, EventContextSupplier<T> supplier);
}
public interface EventContextSupplier<T> {
EventContextKey<T> key();
// Cause has an accessor for the context, so you can freely take a context from the existing cause.
// And ultimately, a predicate is just a matter of returning an empty optional.
Function<Cause, Optional<T>> calculator();
} |
Why would you want |
I'm debating on whether a function "needs to be called" versus something that can be broken down to predicates, potentially thinking of the possibility of slight exposure to the |
In the same vein of how permission context calculators work, event context calculators would automatically add
EventContextKey
s to an event's context.A rough outline:
The text was updated successfully, but these errors were encountered: