Class Messages


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

      • 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.
      • redBold

        public static final String redBold​(String text)
      • underline

        public static final String underline​(String text)