Package com.google.inject.internal
Class Messages
- java.lang.Object
-
- com.google.inject.internal.Messages
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
bold(String text)
static Message
create(ErrorId errorId, String messageFormat, Object... arguments)
Creates a new Message without a cause.static Message
create(ErrorId errorId, Throwable cause, String messageFormat, Object... arguments)
Creates a new Message with the given cause.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.static String
faint(String text)
static String
format(String messageFormat, Object... arguments)
CallsString.format(java.lang.String, java.lang.Object...)
after converting the arguments using some standard guice formatting forKey
,Class
andMember
objects.static String
formatMessages(String heading, Collection<Message> errorMessages)
Returns the formatted message for an exception with the specified messages.static Throwable
getOnlyCause(Collection<Message> messages)
Returns the cause throwable if there is exactly one cause inmessages
.static String
redBold(String text)
static String
underline(String text)
-
-
-
Method Detail
-
format
public static String format(String messageFormat, Object... arguments)
CallsString.format(java.lang.String, java.lang.Object...)
after converting the arguments using some standard guice formatting forKey
,Class
andMember
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 errormessageFormat
- Format stringarguments
- 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 errorcause
- The exception that caused the errormessageFormat
- Format stringarguments
- 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 errorcause
- The exception that caused the errorsources
- The binding sources for the source stackmessageFormat
- Format stringarguments
- format string arguments
-
getOnlyCause
public static Throwable getOnlyCause(Collection<Message> messages)
Returns the cause throwable if there is exactly one cause inmessages
. If there are zero or multiple messages with causes, null is returned.
-
-