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

pack-priv final Class DuplicateMapKeyError<K, V>

extends InternalErrorDetail<DuplicateMapKeyError<K, V>>
Class Inheritance
Imports
com.google.common.collect.Multimap, com.google.inject.Binding, .Key, com.google.inject.spi.ErrorDetail, java.util.Collection, .Formatter, .List, .Map, .Set

Error reported by Guice when a duplicate key is found in a MapBinder that does not permit duplicates.

Field Summary

Modifier and TypeField and Description
private final Multimap<K, Binding<V>>
private final Key<Map<K, V>>
Inherited from com.google.inject.internal.InternalErrorDetail:
errorId

Constructor Summary

AccessConstructor and Description
pack-priv
DuplicateMapKeyError(Key<Map<K, V>> mapKey, Multimap<K, Binding<V>> duplicates, List<Object> sources)

Method Summary

Modifier and TypeMethod and Description
protected final void
formatDetail(List<ErrorDetail<?>>
list of errors that are mergeable with this error
others
,
Formatter
for printing the error message
formatter
)

Implements abstract com.google.inject.spi.ErrorDetail.formatDetail.

Formats the detail of this error message along with other errors that are mergeable with this error.
private static <K, V> String
getDuplicateKeysMessage(Key<Map<K, V>> mapKey, Multimap<K, Binding<V>> duplicates)

public DuplicateMapKeyError<K, V>
withSources(List<Object> newSources)

Implements abstract com.google.inject.spi.ErrorDetail.withSources.

Returns a new instance of the same ErrorDetail with updated sources.
Inherited from com.google.inject.internal.InternalErrorDetail:
getErrorIdentifiergetLearnMoreLink

Field Detail

duplicatesback to summary
private final Multimap<K, Binding<V>> duplicates
mapKeyback to summary
private final Key<Map<K, V>> mapKey

Constructor Detail

DuplicateMapKeyErrorback to summary
pack-priv DuplicateMapKeyError(Key<Map<K, V>> mapKey, Multimap<K, Binding<V>> duplicates, List<Object> sources)

Method Detail

formatDetailback to summary
protected final void formatDetail(List<ErrorDetail<?>> others, Formatter formatter)

Implements abstract com.google.inject.spi.ErrorDetail.formatDetail.

Doc from com.google.inject.spi.ErrorDetail.formatDetail.

Formats the detail of this error message along with other errors that are mergeable with this error. This is called from format.

mergeableErrors is a list that contains all other errors that are reported in the same exception that are considered to be mergable with this error base on result of calling isMergeable. The list will be empty if non of the other errors are mergable with this error.

Parameters
others:List<ErrorDetail<?>>

list of errors that are mergeable with this error

formatter:Formatter

for printing the error message

Annotations
@Override
getDuplicateKeysMessageback to summary
private static <K, V> String getDuplicateKeysMessage(Key<Map<K, V>> mapKey, Multimap<K, Binding<V>> duplicates)
withSourcesback to summary
public DuplicateMapKeyError<K, V> withSources(List<Object> newSources)

Implements abstract com.google.inject.spi.ErrorDetail.withSources.

Doc from com.google.inject.spi.ErrorDetail.withSources.

Returns a new instance of the same ErrorDetail with updated sources.

Annotations
@Override