Top Description Fields Constructors Methods
com.google.inject.internal

pack-priv final Class ChildBindingAlreadySetError

extends InternalErrorDetail<ChildBindingAlreadySetError>
Class Inheritance
Imports
com.google.common.collect.ImmutableList, .Streams, com.google.inject.Key, com.google.inject.spi.ErrorDetail, java.util.ArrayList, .Formatter, .List, java.util.stream.Collectors

Error reported by Guice when a key is already bound in one or more child injectors or private modules.

Field Summary

Modifier and TypeField and Description
private final ImmutableList<Object>
private final Key<?>
Inherited from com.google.inject.internal.InternalErrorDetail:
errorId

Constructor Summary

AccessConstructor and Description
pack-priv
ChildBindingAlreadySetError(Key<?> key, Iterable<Object> existingSoruces, List<Object> sources)

Method Summary

Modifier and TypeMethod and Description
public void
formatDetail(List<ErrorDetail<?>>
list of errors that are mergeable with this error
mergeableErrors
,
Formatter
for printing the error message
formatter
)

Implements abstract com.google.inject.spi.ErrorDetail.formatDetail.

Formats the detail of this error message along with other errors that are mergeable with this error.
public boolean
isMergeable(ErrorDetail<?> otherError)

Overrides com.google.inject.spi.ErrorDetail.isMergeable.

Returns true if this error can be merged with the otherError and formatted together.
private List<Object>
trimSource(List<Object> sources)

Omit the key itself in the source list since the information is redundant.

public ChildBindingAlreadySetError
withSources(List<Object> newSources)

Implements abstract com.google.inject.spi.ErrorDetail.withSources.

Returns a new instance of the same ErrorDetail with updated sources.
Inherited from com.google.inject.internal.InternalErrorDetail:
getErrorIdentifiergetLearnMoreLink

Field Detail

existingSourcesback to summary
private final ImmutableList<Object> existingSources
keyback to summary
private final Key<?> key

Constructor Detail

ChildBindingAlreadySetErrorback to summary
pack-priv ChildBindingAlreadySetError(Key<?> key, Iterable<Object> existingSoruces, List<Object> sources)

Method Detail

formatDetailback to summary
public void formatDetail(List<ErrorDetail<?>> mergeableErrors, Formatter formatter)

Implements abstract com.google.inject.spi.ErrorDetail.formatDetail.

Doc from com.google.inject.spi.ErrorDetail.formatDetail.

Formats the detail of this error message along with other errors that are mergeable with this error. This is called from format.

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 isMergeable. The list will be empty if non of the other errors are mergable with this error.

Parameters
mergeableErrors:List<ErrorDetail<?>>

list of errors that are mergeable with this error

formatter:Formatter

for printing the error message

Annotations
@Override
isMergeableback to summary
public boolean isMergeable(ErrorDetail<?> otherError)

Overrides com.google.inject.spi.ErrorDetail.isMergeable.

Doc from com.google.inject.spi.ErrorDetail.isMergeable.

Returns true if this error can be merged with the otherError and formatted together.

By default this return false and implementations that support merging with other errors should override this method.

Annotations
@Override
trimSourceback to summary
private List<Object> trimSource(List<Object> sources)

Omit the key itself in the source list since the information is redundant.

withSourcesback to summary
public ChildBindingAlreadySetError withSources(List<Object> newSources)

Implements abstract com.google.inject.spi.ErrorDetail.withSources.

Doc from com.google.inject.spi.ErrorDetail.withSources.

Returns a new instance of the same ErrorDetail with updated sources.

Annotations
@Override