Package com.tnsai.hooks
Record Class HookMatcher.Regex<E extends HookEvent>
java.lang.Object
java.lang.Record
com.tnsai.hooks.HookMatcher.Regex<E>
- All Implemented Interfaces:
HookMatcher<E>
- Enclosing interface:
HookMatcher<E extends HookEvent>
public static record HookMatcher.Regex<E extends HookEvent>(Pattern pattern)
extends Record
implements HookMatcher<E>
Pattern applied to
HookEvent.eventType(). Compiled once at
construction so every dispatch is a cheap regex find.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.hooks.HookMatcher
HookMatcher.All<E extends HookEvent>, HookMatcher.Predicate<E extends HookEvent>, HookMatcher.Regex<E extends HookEvent> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturnstruewhen this matcher should fire forevent.static <E extends HookEvent>
HookMatcher.Regex<E> Convenience: compile the pattern from a string.pattern()Returns the value of thepatternrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Regex
Creates an instance of aRegexrecord class.- Parameters:
pattern- the value for thepatternrecord component
-
-
Method Details
-
of
Convenience: compile the pattern from a string. -
matches
Description copied from interface:HookMatcherReturnstruewhen this matcher should fire forevent.- Specified by:
matchesin interfaceHookMatcher<E extends HookEvent>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
pattern
Returns the value of thepatternrecord component.- Returns:
- the value of the
patternrecord component
-