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:
Serializable
Error reported by Guice when duplicate elements are found in a
Multibinder
that does not
permit duplicates.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.collect.ImmutableMultimap<T,
DuplicateElementError.Element<T>> Fields inherited from class com.google.inject.internal.InternalErrorDetail
errorId
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
DuplicateElementError
(Key<Set<T>> setKey, com.google.common.collect.ImmutableMultimap<T, DuplicateElementError.Element<T>> elements, List<Object> sources) (package private)
DuplicateElementError
(Key<Set<T>> setKey, List<Binding<T>> bindings, T[] values, List<Object> sources) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
formatDetail
(List<ErrorDetail<?>> others, 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, Formatter formatter) (package private) static <T> com.google.common.collect.ImmutableMultimap<T,
DuplicateElementError.Element<T>> indexElements
(List<Binding<T>> bindings, T[] values) withSources
(List<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 Details
-
setKey
-
elements
private final com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> elements
-
-
Constructor Details
-
DuplicateElementError
-
DuplicateElementError
-
-
Method Details
-
formatDetail
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
-
withSources
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(List<Binding<T>> bindings, T[] values)
-