Class Messages

java.lang.Object
com.google.inject.internal.Messages

public final class Messages extends Object
Utility methods for Message objects
  • Method Details

    • format

      public static String format(String messageFormat, Object... arguments)
      Calls String.format(java.lang.String, java.lang.Object...) after converting the arguments using some standard guice formatting for Key, Class and Member objects.
    • formatMessages

      public static String formatMessages(String heading, Collection<Message> errorMessages)
      Returns the formatted message for an exception with the specified messages.
    • create

      public static Message create(ErrorId errorId, String messageFormat, Object... arguments)
      Creates a new Message without a cause.
      Parameters:
      errorId - The enum id for the error
      messageFormat - Format string
      arguments - format string arguments
    • create

      public static Message create(ErrorId errorId, Throwable cause, String messageFormat, Object... arguments)
      Creates a new Message with the given cause.
      Parameters:
      errorId - The enum id for the error
      cause - The exception that caused the error
      messageFormat - Format string
      arguments - format string arguments
    • create

      public static Message create(ErrorId errorId, Throwable cause, List<Object> sources, String messageFormat, Object... arguments)
      Creates a new Message with the given cause and a binding source stack.
      Parameters:
      errorId - The enum id for the error
      cause - The exception that caused the error
      sources - The binding sources for the source stack
      messageFormat - Format string
      arguments - format string arguments
    • getOnlyCause

      public static Throwable getOnlyCause(Collection<Message> messages)
      Returns the cause throwable if there is exactly one cause in messages. If there are zero or multiple messages with causes, null is returned.
    • bold

      public static final String bold(String text)
    • redBold

      public static final String redBold(String text)
    • underline

      public static final String underline(String text)
    • faint

      public static final String faint(String text)