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 class
private static final class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Object
appendModules
(Object source, ElementSource elementSource) (package private) static Object
Formats an object in a user friendly way.(package private) static Object
convert
(Object o, ElementSource source) static Message
Creates a new Message without a cause.static Message
Creates a new Message with the given cause.static Message
Creates a new Message with the given cause and a binding source stack.static String
CallsString.format(java.lang.String, java.lang.Object...)
after converting the arguments using some standard guice formatting forKey
,Class
andMember
objects.private static void
formatInjectionPoint
(Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint, ElementSource elementSource) static String
formatMessages
(String heading, Collection<Message> errorMessages) Returns the formatted message for an exception with the specified messages.(package private) static String
formatParameter
(Dependency<?> dependency) (package private) static void
formatSource
(Formatter formatter, Object source) (package private) static void
formatSource
(Formatter formatter, Object source, ElementSource elementSource) static Throwable
getOnlyCause
(Collection<Message> messages) Returns the cause throwable if there is exactly one cause inmessages
.private static String
getOrdinalSuffix
(int ordinal) Maps1
to the string"1st"
ditto for all non-negative numbers(package private) static Message
mergeSources
(List<Object> sources, Message message) Prepends the list of sources to the givenMessage
private static String
moduleSourceString
(ElementSource elementSource)
-
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
,Class
andMember
objects. -
formatMessages
Returns the formatted message for an exception with the specified messages. -
create
Creates a new Message without a cause.- Parameters:
messageFormat
- Format stringarguments
- format string arguments
-
create
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(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 errorsources
- The binding sources for the source stackmessageFormat
- Format stringarguments
- format string arguments
-
convert
Formats an object in a user friendly way. -
convert
-
appendModules
-
moduleSourceString
-
formatSource
-
formatSource
-
formatInjectionPoint
private static void formatInjectionPoint(Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint, ElementSource elementSource) -
formatParameter
-
getOrdinalSuffix
Maps1
to the string"1st"
ditto for all non-negative numbers -
getOnlyCause
Returns the cause throwable if there is exactly one cause inmessages
. If there are zero or multiple messages with causes, null is returned.
-