Package com.tnsai.hooks
Interface HookMatcher<E extends HookEvent>
- All Known Implementing Classes:
HookMatcher.All,HookMatcher.Predicate,HookMatcher.Regex
public sealed interface HookMatcher<E extends HookEvent>
permits HookMatcher.Regex<E>, HookMatcher.Predicate<E>, HookMatcher.All<E>
Filters whether a
Hook fires for a given
event (issue #58). Sealed so the dispatcher's dispatch path is
exhaustive.
HookMatcher.Regex— matches when the event'sHookEvent.eventType()matches the supplied regex. Default matcher for "fire on everyPreToolUse" style.HookMatcher.Predicate— arbitrary typed predicate on the event. Use when matching requires inspecting payload fields (e.g. tool name, input shape).HookMatcher.All— unconditional match; useful for logging hooks that observe every event in their category.
- Since:
- 0.5.0 (issue #58)
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordHookMatcher.All<E extends HookEvent>Unconditional match.static final recordHookMatcher.Predicate<E extends HookEvent>Arbitrary typed predicate — use when regex-on-eventType isn't enough (payload field inspection, cross-field rules).static final recordHookMatcher.Regex<E extends HookEvent>Pattern applied toHookEvent.eventType(). -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends HookEvent>
HookMatcher<E> all()booleanReturnstruewhen this matcher should fire forevent.static <E extends HookEvent>
HookMatcher<E> static <E extends HookEvent>
HookMatcher<E>
-
Method Details
-
matches
Returnstruewhen this matcher should fire forevent. -
all
-
regex
-
predicate
-