Package com.google.inject.internal
Class Messages
- java.lang.Object
-
- com.google.inject.internal.Messages
-
public final class Messages extends java.lang.ObjectUtility methods forMessageobjects
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classMessages.Converter<T>private static classMessages.ThrowableEquivalence
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Collection<Messages.Converter<?>>converters
-
Constructor Summary
Constructors Modifier Constructor Description privateMessages()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.ObjectappendModules(java.lang.Object source, ElementSource elementSource)(package private) static java.lang.Objectconvert(java.lang.Object o)Formats an object in a user friendly way.(package private) static java.lang.Objectconvert(java.lang.Object o, ElementSource source)static Messagecreate(java.lang.String messageFormat, java.lang.Object... arguments)Creates a new Message without a cause.static Messagecreate(java.lang.Throwable cause, java.lang.String messageFormat, java.lang.Object... arguments)Creates a new Message with the given cause.static Messagecreate(java.lang.Throwable cause, java.util.List<java.lang.Object> sources, java.lang.String messageFormat, java.lang.Object... arguments)Creates a new Message with the given cause and a binding source stack.static java.lang.Stringformat(java.lang.String messageFormat, java.lang.Object... arguments)CallsString.format(java.lang.String, java.lang.Object...)after converting the arguments using some standard guice formatting forKey,ClassandMemberobjects.private static voidformatInjectionPoint(java.util.Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint, ElementSource elementSource)static java.lang.StringformatMessages(java.lang.String heading, java.util.Collection<Message> errorMessages)Returns the formatted message for an exception with the specified messages.(package private) static java.lang.StringformatParameter(Dependency<?> dependency)(package private) static voidformatSource(java.util.Formatter formatter, java.lang.Object source)(package private) static voidformatSource(java.util.Formatter formatter, java.lang.Object source, ElementSource elementSource)static java.lang.ThrowablegetOnlyCause(java.util.Collection<Message> messages)Returns the cause throwable if there is exactly one cause inmessages.private static java.lang.StringgetOrdinalSuffix(int ordinal)Maps1to the string"1st"ditto for all non-negative numbers(package private) static MessagemergeSources(java.util.List<java.lang.Object> sources, Message message)Prepends the list of sources to the givenMessageprivate static java.lang.StringmoduleSourceString(ElementSource elementSource)
-
-
-
Field Detail
-
converters
private static final java.util.Collection<Messages.Converter<?>> converters
-
-
Method Detail
-
mergeSources
static Message mergeSources(java.util.List<java.lang.Object> sources, Message message)
Prepends the list of sources to the givenMessage
-
format
public static java.lang.String format(java.lang.String messageFormat, java.lang.Object... arguments)CallsString.format(java.lang.String, java.lang.Object...)after converting the arguments using some standard guice formatting forKey,ClassandMemberobjects.
-
formatMessages
public static java.lang.String formatMessages(java.lang.String heading, java.util.Collection<Message> errorMessages)Returns the formatted message for an exception with the specified messages.
-
create
public static Message create(java.lang.String messageFormat, java.lang.Object... arguments)
Creates a new Message without a cause.- Parameters:
messageFormat- Format stringarguments- format string arguments
-
create
public static Message create(java.lang.Throwable cause, java.lang.String messageFormat, java.lang.Object... arguments)
Creates a new Message with the given cause.- Parameters:
cause- The exception that caused the errormessageFormat- Format stringarguments- format string arguments
-
create
public static Message create(java.lang.Throwable cause, java.util.List<java.lang.Object> sources, java.lang.String messageFormat, java.lang.Object... arguments)
Creates a new Message with the given cause and a binding source stack.- Parameters:
cause- The exception that caused the errorsources- The binding sources for the source stackmessageFormat- Format stringarguments- format string arguments
-
convert
static java.lang.Object convert(java.lang.Object o)
Formats an object in a user friendly way.
-
convert
static java.lang.Object convert(java.lang.Object o, ElementSource source)
-
appendModules
private static java.lang.Object appendModules(java.lang.Object source, ElementSource elementSource)
-
moduleSourceString
private static java.lang.String moduleSourceString(ElementSource elementSource)
-
formatSource
static void formatSource(java.util.Formatter formatter, java.lang.Object source)
-
formatSource
static void formatSource(java.util.Formatter formatter, java.lang.Object source, ElementSource elementSource)
-
formatInjectionPoint
private static void formatInjectionPoint(java.util.Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint, ElementSource elementSource)
-
formatParameter
static java.lang.String formatParameter(Dependency<?> dependency)
-
getOrdinalSuffix
private static java.lang.String getOrdinalSuffix(int ordinal)
Maps1to the string"1st"ditto for all non-negative numbers
-
getOnlyCause
public static java.lang.Throwable getOnlyCause(java.util.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.
-
-