Top Description Inners Fields Constructors Methods
com.google.inject.internal

public final Class Messages

extends Object
Class Inheritance
Static Imports
java.util.stream.Collectors.joining

Utility methods for Message objects

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
private static enum
private static class

Field Summary

Modifier and TypeField and Description
private static final Collection<Messages.Converter<?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Object
appendModules(Object source, ElementSource elementSource)

public static final String
bold(String text)

pack-priv static Object
convert(Object o)

Formats an object in a user friendly way.

pack-priv static Object
public static Message
create(ErrorId
The enum id for the error
errorId
,
String
Format string
messageFormat
,
Object...
format string arguments
arguments
)

Creates a new Message without a cause.

public static Message
create(ErrorId
The enum id for the error
errorId
,
Throwable
The exception that caused the error
cause
,
String
Format string
messageFormat
,
Object...
format string arguments
arguments
)

Creates a new Message with the given cause.

public static Message
create(ErrorId
The enum id for the error
errorId
,
Throwable
The exception that caused the error
cause
,
List<Object>
The binding sources for the source stack
sources
,
String
Format string
messageFormat
,
Object...
format string arguments
arguments
)

Creates a new Message with the given cause and a binding source stack.

public static final String
faint(String text)

public static String
format(String messageFormat, Object... arguments)

Calls String#format after converting the arguments using some standard guice formatting for Key, Class and Member objects.

public static String
formatMessages(String heading, Collection<Message> errorMessages)

Returns the formatted message for an exception with the specified messages.

private static final String
public static Throwable
getOnlyCause(Collection<Message> messages)

Returns the cause throwable if there is exactly one cause in messages.

pack-priv static Message
mergeSources(List<Object> sources, Message message)

Prepends the list of sources to the given Message

public static final String
public static final String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

convertersback to summary
private static final Collection<Messages.Converter<?>> converters
Annotations
@SuppressWarnings:unchecked, rawtypes

Constructor Detail

Messagesback to summary
private Messages()

Method Detail

appendModulesback to summary
private static Object appendModules(Object source, ElementSource elementSource)
boldback to summary
public static final String bold(String text)
convertback to summary
pack-priv static Object convert(Object o)

Formats an object in a user friendly way.

convertback to summary
pack-priv static Object convert(Object o, ElementSource source)
createback to summary
public static Message create(ErrorId errorId, String messageFormat, Object... arguments)

Creates a new Message without a cause.

Parameters
errorId:ErrorId

The enum id for the error

messageFormat:String

Format string

arguments:Object[]

format string arguments

createback to summary
public static Message create(ErrorId errorId, Throwable cause, String messageFormat, Object... arguments)

Creates a new Message with the given cause.

Parameters
errorId:ErrorId

The enum id for the error

cause:Throwable

The exception that caused the error

messageFormat:String

Format string

arguments:Object[]

format string arguments

createback to summary
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:ErrorId

The enum id for the error

cause:Throwable

The exception that caused the error

sources:List<Object>

The binding sources for the source stack

messageFormat:String

Format string

arguments:Object[]

format string arguments

faintback to summary
public static final String faint(String text)
formatback to summary
public static String format(String messageFormat, Object... arguments)

Calls String#format after converting the arguments using some standard guice formatting for Key, Class and Member objects.

formatMessagesback to summary
public static String formatMessages(String heading, Collection<Message> errorMessages)

Returns the formatted message for an exception with the specified messages.

formatTextback to summary
private static final String formatText(String text, Messages.FormatOptions... options)
getOnlyCauseback to summary
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.

mergeSourcesback to summary
pack-priv static Message mergeSources(List<Object> sources, Message message)

Prepends the list of sources to the given Message

redBoldback to summary
public static final String redBold(String text)
underlineback to summary
public static final String underline(String text)
com.google.inject.internal back to summary

private abstract Class Messages.Converter<T>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Class<T>

Constructor Summary

AccessConstructor and Description
pack-priv
Converter(Class<T> type)

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv String
pack-priv abstract String
toString(T t)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

typeback to summary
pack-priv final Class<T> type

Constructor Detail

Converterback to summary
pack-priv Converter(Class<T> type)

Method Detail

appliesToback to summary
pack-priv boolean appliesTo(Object o)
convertback to summary
pack-priv String convert(Object o)
toStringback to summary
pack-priv abstract String toString(T t)
com.google.inject.internal back to summary

private final Enum Messages.FormatOptions

extends Enum<Messages.FormatOptions>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String
public static final Messages.FormatOptions
public static final Messages.FormatOptions
public static final Messages.FormatOptions
public static final Messages.FormatOptions
public static final Messages.FormatOptions
public static final Messages.FormatOptions

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Messages.FormatOptions
public static Messages.FormatOptions[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ansiCodeback to summary
private final String ansiCode
BOLDback to summary
public static final Messages.FormatOptions BOLD
FAINTback to summary
public static final Messages.FormatOptions FAINT
ITALICback to summary
public static final Messages.FormatOptions ITALIC
REDback to summary
public static final Messages.FormatOptions RED
RESETback to summary
public static final Messages.FormatOptions RESET
UNDERLINEback to summary
public static final Messages.FormatOptions UNDERLINE

Constructor Detail

FormatOptionsback to summary
private FormatOptions(String ansiCode)

Method Detail

valueOfback to summary
public static Messages.FormatOptions valueOf(String name)
valuesback to summary
public static Messages.FormatOptions[] values()
com.google.inject.internal back to summary

private final Class Messages.ThrowableEquivalence

extends Equivalence<Throwable>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final Messages.ThrowableEquivalence

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected boolean
doEquivalent(Throwable a, Throwable b)

Implements abstract com.google.common.base.Equivalence.doEquivalent.

Implemented by the user to determine whether a and b are considered equivalent, subject to the requirements specified in equivalent.
protected int
doHash(Throwable t)

Implements abstract com.google.common.base.Equivalence.doHash.

Implemented by the user to return a hash code for t, subject to the requirements specified in hash.
Inherited from com.google.common.base.Equivalence:
equalsequivalentequivalentTohashidentityonResultOfpairwisetestwrap

Field Detail

INSTANCEback to summary
pack-priv static final Messages.ThrowableEquivalence INSTANCE

Constructor Detail

ThrowableEquivalenceback to summary
private ThrowableEquivalence()

Method Detail

doEquivalentback to summary
protected boolean doEquivalent(Throwable a, Throwable b)

Implements abstract com.google.common.base.Equivalence.doEquivalent.

Doc from com.google.common.base.Equivalence.doEquivalent.

Implemented by the user to determine whether a and b are considered equivalent, subject to the requirements specified in equivalent.

This method should not be called except by equivalent. When equivalent calls this method, a and b are guaranteed to be distinct, non-null instances.

Annotations
@Override
doHashback to summary
protected int doHash(Throwable t)

Implements abstract com.google.common.base.Equivalence.doHash.

Doc from com.google.common.base.Equivalence.doHash.

Implemented by the user to return a hash code for t, subject to the requirements specified in hash.

This method should not be called except by hash. When hash calls this method, t is guaranteed to be non-null.

Annotations
@Override