Class MessageBuilder

java.lang.Object
io.github.chrimle.exceptionfactory.MessageBuilder

public final class MessageBuilder extends Object
Builder of message strings.
Since:
0.4.0
  • Method Details

    • newMessageBuilder

      @Contract(" -> new") @NotNull public static @NotNull MessageBuilder newMessageBuilder()
      Factory method for instantiating MessageBuilder.
      Returns:
      a new instance.
      Since:
      0.4.0
    • addFormatSpecifier

      @Contract("null -> fail; _ -> this") public MessageBuilder addFormatSpecifier(Class<?> formatClass)
      Adds a format specifier, based on the formatClass, to this builder.
      Parameters:
      formatClass - to format.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - if formatClass is null.
      Since:
      0.4.0
    • addCodeQuote

      @Contract("null -> fail; _ -> this") public MessageBuilder addCodeQuote(Object object)
      Adds a code quoted string representation of the object, within ``-quotes, to this builder.
      Parameters:
      object - to quote and add.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - if object is null.
      Since:
      0.4.0
    • add

      @Contract("null -> fail; _ -> this") public MessageBuilder add(Object object)
      Adds a string representation of the object, via Object.toString(), to this builder.
      Parameters:
      object - to add.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - if object is null.
      Since:
      0.4.0
    • toString

      public String toString()
      Overrides:
      toString in class Object