com.google.inject.internal

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(String messageFormat,
                                     Object... arguments)
        Creates a new Message without a cause.
        Parameters:
        messageFormat - Format string
        arguments - format string arguments
      • create

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

        public static Message create(Throwable cause,
                                     List<Object> sources,
                                     String messageFormat,
                                     Object... arguments)
        Creates a new Message with the given cause and a binding source stack.
        Parameters:
        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.

Copyright © 2006–2020 Google, Inc.. All rights reserved.