Package com.google.inject.internal
Class Messages
java.lang.Object
com.google.inject.internal.Messages
Utility methods for
Message objects-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static enumprivate static final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ObjectappendModules(Object source, ElementSource elementSource) static final String(package private) static ObjectFormats an object in a user friendly way.(package private) static Objectconvert(Object o, ElementSource source) static MessageCreates a new Message without a cause.static MessageCreates a new Message with the given cause.static Messagecreate(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 final Stringstatic StringCallsString.format(java.lang.String, java.lang.Object...)after converting the arguments using some standard guice formatting forKey,ClassandMemberobjects.static StringformatMessages(String heading, Collection<Message> errorMessages) Returns the formatted message for an exception with the specified messages.private static final StringformatText(String text, Messages.FormatOptions... options) static ThrowablegetOnlyCause(Collection<Message> messages) Returns the cause throwable if there is exactly one cause inmessages.(package private) static MessagemergeSources(List<Object> sources, Message message) Prepends the list of sources to the givenMessagestatic final Stringstatic final String
-
Field Details
-
converters
-
-
Constructor Details
-
Messages
private Messages()
-
-
Method Details
-
mergeSources
Prepends the list of sources to the givenMessage -
format
CallsString.format(java.lang.String, java.lang.Object...)after converting the arguments using some standard guice formatting forKey,ClassandMemberobjects. -
formatMessages
Returns the formatted message for an exception with the specified messages. -
create
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
-
convert
Formats an object in a user friendly way. -
convert
-
appendModules
-
getOnlyCause
Returns the cause throwable if there is exactly one cause inmessages. If there are zero or multiple messages with causes, null is returned. -
formatText
-
bold
-
redBold
-
underline
-
faint
-