final class DuplicateMapKeyError<K,V> extends InternalErrorDetail<DuplicateMapKeyError<K,V>>
MapBinder
that does not permit
duplicates.Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.Multimap<K,Binding<V>> |
duplicates |
private Key<java.util.Map<K,V>> |
mapKey |
errorId
Constructor and Description |
---|
DuplicateMapKeyError(Key<java.util.Map<K,V>> mapKey,
com.google.common.collect.Multimap<K,Binding<V>> duplicates,
java.util.List<java.lang.Object> sources) |
Modifier and Type | Method and 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.String |
getDuplicateKeysMessage(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 same
ErrorDetail with updated sources. |
getErrorIdentifier, getLearnMoreLink
equals, format, getCause, getMessage, getSources, hashCode, isMergeable
protected final void formatDetail(java.util.List<ErrorDetail<?>> others, java.util.Formatter formatter)
ErrorDetail
ErrorDetail.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 calling
ErrorDetail.isMergeable(com.google.inject.spi.ErrorDetail<?>)
. The list will be empty if non of the other errors are mergable with this
error.
formatDetail
in class ErrorDetail<DuplicateMapKeyError<K,V>>
others
- list of errors that are mergeable with this errorformatter
- for printing the error messagepublic DuplicateMapKeyError<K,V> withSources(java.util.List<java.lang.Object> newSources)
ErrorDetail
ErrorDetail
with updated sources.withSources
in class ErrorDetail<DuplicateMapKeyError<K,V>>