java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.pipeline.processors.MessageProcessor
All Implemented Interfaces:
Processor

public class MessageProcessor extends Object implements Processor
Default implementation of the Processor interface responsible for performing macro replacement on message fields.

This class uses a MacroReplacer to apply all relevant placeholder substitutions on a ValidMessageRecord, producing a new FinalMessageRecord with all final strings populated.

It serves as the final step in the message pipeline before rendering or dispatching.

See Also:
  • Constructor Details

    • MessageProcessor

      public MessageProcessor(ValueResolver resolver, PlaceholderMatcher placeholderMatcher)
      Constructs a MessageProcessor using the provided ValueResolver and PlaceholderMatcher to configure the underlying MacroReplacer.
      Parameters:
      resolver - the macro resolver used to extract string representations from context objects
      placeholderMatcher - the placeholder matcher used to detect macro keys in strings
  • Method Details

    • process

      public FinalMessageRecord process(ValidMessageRecord messageRecord, MacroObjectMap macroObjectMap)
      Processes a ValidMessageRecord by replacing all macros in its fields using the provided MacroObjectMap, and return new message record with final string fields added with macro replacements performed.

      This includes the message, title, and subtitle fields, which are resolved and returned as part of a new FinalMessageRecord.

      Specified by:
      process in interface Processor
      Parameters:
      messageRecord - the valid message record to process
      macroObjectMap - the macro context object map used to resolve placeholder values
      Returns:
      a FinalMessageRecord with all macros resolved and final strings populated