Package com.google.inject.internal
Class DuplicateElementError<T>
- java.lang.Object
-
- com.google.inject.spi.ErrorDetail<T>
-
- com.google.inject.internal.InternalErrorDetail<DuplicateElementError<T>>
-
- com.google.inject.internal.DuplicateElementError<T>
-
- All Implemented Interfaces:
java.io.Serializable
final class DuplicateElementError<T> extends InternalErrorDetail<DuplicateElementError<T>>
Error reported by Guice when duplicate elements are found in aMultibinder
that does not permit duplicates.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
DuplicateElementError.Element<T>
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>>
elements
private Key<java.util.Set<T>>
setKey
-
Fields inherited from class com.google.inject.internal.InternalErrorDetail
errorId
-
-
Constructor Summary
Constructors Modifier Constructor Description private
DuplicateElementError(Key<java.util.Set<T>> setKey, com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> elements, java.util.List<java.lang.Object> sources)
(package private)
DuplicateElementError(Key<java.util.Set<T>> setKey, java.util.List<Binding<T>> bindings, T[] values, java.util.List<java.lang.Object> sources)
-
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 void
formatElement(DuplicateElementError.Element<T> element, java.util.Formatter formatter)
(package private) static <T> com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>>
indexElements(java.util.List<Binding<T>> bindings, T[] values)
DuplicateElementError<T>
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
-
-
-
-
Field Detail
-
elements
private final com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> elements
-
-
Constructor Detail
-
DuplicateElementError
DuplicateElementError(Key<java.util.Set<T>> setKey, java.util.List<Binding<T>> bindings, T[] values, java.util.List<java.lang.Object> sources)
-
DuplicateElementError
private DuplicateElementError(Key<java.util.Set<T>> setKey, com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> elements, java.util.List<java.lang.Object> sources)
-
-
Method Detail
-
formatDetail
protected 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<DuplicateElementError<T>>
- Parameters:
others
- list of errors that are mergeable with this errorformatter
- for printing the error message
-
formatElement
private void formatElement(DuplicateElementError.Element<T> element, java.util.Formatter formatter)
-
withSources
public DuplicateElementError<T> 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<DuplicateElementError<T>>
-
indexElements
static <T> com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> indexElements(java.util.List<Binding<T>> bindings, T[] values)
-
-