Package com.google.inject.internal
Class DuplicateMapKeyError<K,V>
- java.lang.Object
-
- com.google.inject.spi.ErrorDetail<T>
-
- com.google.inject.internal.InternalErrorDetail<DuplicateMapKeyError<K,V>>
-
- com.google.inject.internal.DuplicateMapKeyError<K,V>
-
- All Implemented Interfaces:
java.io.Serializable
final class DuplicateMapKeyError<K,V> extends InternalErrorDetail<DuplicateMapKeyError<K,V>>
Error reported by Guice when a duplicate key is found in aMapBinder
that does not permit duplicates.
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.collect.Multimap<K,Binding<V>>
duplicates
private Key<java.util.Map<K,V>>
mapKey
-
Fields inherited from class com.google.inject.internal.InternalErrorDetail
errorId
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
formatDetail(java.util.List<ErrorDetail<?>> others, java.util.Formatter formatter)
Formats the detail of this error message along with other errors that are mergeable with this error.private static <K,V>
java.lang.StringgetDuplicateKeysMessage(Key<java.util.Map<K,V>> mapKey, com.google.common.collect.Multimap<K,Binding<V>> duplicates)
DuplicateMapKeyError<K,V>
withSources(java.util.List<java.lang.Object> newSources)
Returns a new instance of the sameErrorDetail
with updated sources.-
Methods inherited from class com.google.inject.internal.InternalErrorDetail
getErrorIdentifier, getLearnMoreLink
-
Methods inherited from class com.google.inject.spi.ErrorDetail
equals, format, getCause, getMessage, getSources, hashCode, isMergeable
-
-
-
-
Method Detail
-
formatDetail
protected final void formatDetail(java.util.List<ErrorDetail<?>> others, java.util.Formatter formatter)
Description copied from class:ErrorDetail
Formats the detail of this error message along with other errors that are mergeable with this error. This is called fromErrorDetail.format(int, java.util.List<com.google.inject.spi.ErrorDetail<?>>, java.util.Formatter)
.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 callingErrorDetail.isMergeable(com.google.inject.spi.ErrorDetail<?>)
. The list will be empty if non of the other errors are mergable with this error.- Specified by:
formatDetail
in classErrorDetail<DuplicateMapKeyError<K,V>>
- Parameters:
others
- list of errors that are mergeable with this errorformatter
- for printing the error message
-
withSources
public DuplicateMapKeyError<K,V> withSources(java.util.List<java.lang.Object> newSources)
Description copied from class:ErrorDetail
Returns a new instance of the sameErrorDetail
with updated sources.- Specified by:
withSources
in classErrorDetail<DuplicateMapKeyError<K,V>>
-
-