final class DuplicateElementError<T> extends InternalErrorDetail<DuplicateElementError<T>>
Multibinder
that does not
permit duplicates.Modifier and Type | Class and Description |
---|---|
(package private) static class |
DuplicateElementError.Element<T> |
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> |
elements |
private Key<java.util.Set<T>> |
setKey |
errorId
Modifier | Constructor and 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) |
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 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 same
ErrorDetail with updated sources. |
getErrorIdentifier, getLearnMoreLink
equals, format, getCause, getMessage, getSources, hashCode, isMergeable
private final com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> elements
DuplicateElementError(Key<java.util.Set<T>> setKey, java.util.List<Binding<T>> bindings, T[] values, java.util.List<java.lang.Object> sources)
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)
protected 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<DuplicateElementError<T>>
others
- list of errors that are mergeable with this errorformatter
- for printing the error messageprivate void formatElement(DuplicateElementError.Element<T> element, java.util.Formatter formatter)
public DuplicateElementError<T> withSources(java.util.List<java.lang.Object> newSources)
ErrorDetail
ErrorDetail
with updated sources.withSources
in class ErrorDetail<DuplicateElementError<T>>
static <T> com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> indexElements(java.util.List<Binding<T>> bindings, T[] values)