Class RegexPlaceholderMatcher
java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.pipeline.matchers.RegexPlaceholderMatcher
- All Implemented Interfaces:
PlaceholderMatcher
Default implementation of the
PlaceholderMatcher interface that uses Java’s built-in
Pattern and MatchResult APIs to extract
macro keys from an input string.
This class transforms matching groups into ValidMacroKey
instances using MacroKey.of(...), and silently skips any invalid results.
It is designed for use in both the resolution and replacement stages of the pipeline, depending on whether base keys or full macro keys are being matched.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExtracts macro keys from the given input string using the specified regular expression pattern.
-
Constructor Details
-
RegexPlaceholderMatcher
public RegexPlaceholderMatcher()
-
-
Method Details
-
match
Description copied from interface:PlaceholderMatcherExtracts macro keys from the given input string using the specified regular expression pattern.Each successful match is converted into a
ValidMacroKey. Implementations may choose to skip invalid or malformed macro segments.- Specified by:
matchin interfacePlaceholderMatcher- Parameters:
input- the raw string to search for macros (e.g., a message from the YAML file)pattern- the regular expression pattern used to locate macro placeholders- Returns:
- a stream of matched
LegacyMacroKeyinstances (may be empty but nevernull)
-