Class PatternReplacingStringProcessor

java.lang.Object
cloud.commandframework.annotations.PatternReplacingStringProcessor
All Implemented Interfaces:
StringProcessor
Direct Known Subclasses:
PropertyReplacingStringProcessor

public class PatternReplacingStringProcessor extends Object implements StringProcessor
StringProcessor that replaces matches of a given Pattern.
Since:
1.7.0
  • Constructor Details

    • PatternReplacingStringProcessor

      public PatternReplacingStringProcessor(@NonNull Pattern pattern, @NonNull Function<@NonNull MatchResult,@Nullable String> replacementProvider)
      Creates a new property replacing string processor.
      Parameters:
      pattern - the pattern to search for
      replacementProvider - function generating the replacement strings
  • Method Details

    • processString

      public @NonNull String processString(@NonNull String input)
      Processes the input string and returns the processed result.

      This should always return a non-null result. If the input string isn't applicable to the processor implementation, the original string should be returned.

      Specified by:
      processString in interface StringProcessor
      Parameters:
      input - the input string
      Returns:
      the processed string