Class MessageBuilder
- java.lang.Object
-
- org.codehaus.plexus.build.messages.MessageBuilder
-
public class MessageBuilder extends java.lang.ObjectBuilder class for constructing messages.This class implements the builder pattern for creating messages with various parameters. It is typically not called directly by client code, but is used internally by the Messages API implementations.
-
-
Constructor Summary
Constructors Constructor Description MessageBuilder(MessageType type, java.nio.file.Path path, java.util.function.Consumer<Message> consumer)Creates a new MessageBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageBuildercause(java.lang.Throwable cause)Sets the exception cause for the message.MessageBuildercolumn(int column)Sets the column number for the message.voidcreate(java.lang.String message)Creates the message object with all collected parameters and informs the consumer.MessageBuilderline(int line)Sets the line number for the message.
-
-
-
Constructor Detail
-
MessageBuilder
public MessageBuilder(MessageType type, java.nio.file.Path path, java.util.function.Consumer<Message> consumer)
Creates a new MessageBuilder.Note: This constructor is usually not called by client code. Use the builder methods provided by the
Messagesinterface instead (e.g., buildError, buildWarning, buildInfo).- Parameters:
type- the type of message to buildpath- the file path for which the message should be createdconsumer- the consumer that will receive the constructed message
-
-
Method Detail
-
line
public MessageBuilder line(int line)
Sets the line number for the message.- Parameters:
line- the line number (1-based, use 0 for unknown)- Returns:
- this builder for method chaining
-
column
public MessageBuilder column(int column)
Sets the column number for the message.- Parameters:
column- the column number (1-based, use 0 for unknown)- Returns:
- this builder for method chaining
-
cause
public MessageBuilder cause(java.lang.Throwable cause)
Sets the exception cause for the message.- Parameters:
cause- the exception that caused this message- Returns:
- this builder for method chaining
-
create
public void create(java.lang.String message)
Creates the message object with all collected parameters and informs the consumer. This method finalizes the builder and creates the message.- Parameters:
message- the message text (must not be null or blank)
-
-