final class ChildBindingAlreadySetError extends InternalErrorDetail<ChildBindingAlreadySetError>
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableList<java.lang.Object> |
existingSources |
private Key<?> |
key |
errorId
Constructor and Description |
---|
ChildBindingAlreadySetError(Key<?> key,
java.lang.Iterable<java.lang.Object> existingSoruces,
java.util.List<java.lang.Object> sources) |
Modifier and Type | Method and Description |
---|---|
void |
formatDetail(java.util.List<ErrorDetail<?>> mergeableErrors,
java.util.Formatter formatter)
Formats the detail of this error message along with other errors that are mergeable with this
error.
|
boolean |
isMergeable(ErrorDetail<?> otherError)
Returns true if this error can be merged with the
otherError and formatted together. |
private java.util.List<java.lang.Object> |
trimSource(java.util.List<java.lang.Object> sources)
Omit the key itself in the source list since the information is redundant.
|
ChildBindingAlreadySetError |
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
private final Key<?> key
private final com.google.common.collect.ImmutableList<java.lang.Object> existingSources
ChildBindingAlreadySetError(Key<?> key, java.lang.Iterable<java.lang.Object> existingSoruces, java.util.List<java.lang.Object> sources)
public boolean isMergeable(ErrorDetail<?> otherError)
ErrorDetail
otherError
and formatted together.
By default this return false and implementations that support merging with other errors should override this method.
isMergeable
in class ErrorDetail<ChildBindingAlreadySetError>
public void formatDetail(java.util.List<ErrorDetail<?>> mergeableErrors, 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<ChildBindingAlreadySetError>
mergeableErrors
- list of errors that are mergeable with this errorformatter
- for printing the error messagepublic ChildBindingAlreadySetError withSources(java.util.List<java.lang.Object> newSources)
ErrorDetail
ErrorDetail
with updated sources.withSources
in class ErrorDetail<ChildBindingAlreadySetError>
private java.util.List<java.lang.Object> trimSource(java.util.List<java.lang.Object> sources)