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

public final Class InternalProvisionException

extends Exception
Class Inheritance
Static Imports
com.google.common.base.Preconditions.checkArgument

A checked exception for provisioning errors.

This is the internal dual of ProvisionException, similar to the relationship between com.google.inject.ConfigurationException and ErrorsException. This is useful for several reasons:

This exception will be thrown when errors are encountered during provisioning, ErrorsException will continue to be used for errors that are encountered during provisioning and both make use of the Message as the core model.

Note

this object stores a list of messages but in the most common case the cardinality will be 1. The only time that multiple errors might be reported via this mechanism is when errorInUserCode is called with an exception that holds multiple errors (like ProvisionException).

Field Summary

Modifier and TypeField and Description
private final ImmutableList<Message>
private static final Logger
private final List<Object>
private static final Set<Dependency<?>>

Constructor Summary

AccessConstructor and Description
pack-priv
private

Method Summary

Modifier and TypeMethod and Description
pack-priv InternalProvisionException

Returns:

this
addSource
(Object source)

Prepends the given source to the stack of binding sources for the errors reported in this exception.

public static InternalProvisionException
cannotProxyClass(Class<?> expectedType)

public static InternalProvisionException
public static InternalProvisionException
create(ErrorId errorId, String format, Object... arguments)

public static InternalProvisionException
public static InternalProvisionException
public static InternalProvisionException
public static InternalProvisionException
errorInUserCode(ErrorId errorId, Throwable cause, String messageFormat, Object... arguments)

public static InternalProvisionException
public static InternalProvisionException
pack-priv ImmutableList<Message>
public static InternalProvisionException
jitDisabled(Key<?> key)

pack-priv static void
onNullInjectedIntoNonNullableDependency(Object source, Dependency<?> dependency)

Returns value if it is non-null or allowed to be null.

public static InternalProvisionException
subtypeNotProvided(Class<? extends Provider<?>> providerType, Class<?> type)

public ProvisionException
toProvisionException()

Returns this exception convered to a ProvisionException.

Field Detail

errorsback to summary
private final ImmutableList<Message> errors
loggerback to summary
private static final Logger logger
sourcesToPrependback to summary
private final List<Object> sourcesToPrepend
warnedDependenciesback to summary
private static final Set<Dependency<?>> warnedDependencies

Constructor Detail

InternalProvisionExceptionback to summary
pack-priv InternalProvisionException(Message error)
InternalProvisionExceptionback to summary
private InternalProvisionException(Iterable<Message> errors)

Method Detail

addSourceback to summary
pack-priv InternalProvisionException addSource(Object source)

Prepends the given source to the stack of binding sources for the errors reported in this exception.

See Errors#withSource(Object)

It is expected that this method is called as the exception propagates up the stack.

Returns:InternalProvisionException

this

cannotProxyClassback to summary
public static InternalProvisionException cannotProxyClass(Class<?> expectedType)
circularDependenciesDisabledback to summary
public static InternalProvisionException circularDependenciesDisabled(Class<?> expectedType)
createback to summary
public static InternalProvisionException create(ErrorId errorId, String format, Object... arguments)
errorInjectingConstructorback to summary
public static InternalProvisionException errorInjectingConstructor(Throwable cause)
errorInjectingMethodback to summary
public static InternalProvisionException errorInjectingMethod(Throwable cause)
errorInProviderback to summary
public static InternalProvisionException errorInProvider(Throwable cause)
errorInUserCodeback to summary
public static InternalProvisionException errorInUserCode(ErrorId errorId, Throwable cause, String messageFormat, Object... arguments)
errorInUserInjectorback to summary
public static InternalProvisionException errorInUserInjector(MembersInjector<?> listener, TypeLiteral<?> type, RuntimeException cause)
errorNotifyingInjectionListenerback to summary
public static InternalProvisionException errorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type, RuntimeException cause)
getErrorsback to summary
pack-priv ImmutableList<Message> getErrors()
jitDisabledback to summary
public static InternalProvisionException jitDisabled(Key<?> key)
onNullInjectedIntoNonNullableDependencyback to summary
pack-priv static void onNullInjectedIntoNonNullableDependency(Object source, Dependency<?> dependency) throws InternalProvisionException

Returns value if it is non-null or allowed to be null. Otherwise a message is added and an InternalProvisionException is thrown.

subtypeNotProvidedback to summary
public static InternalProvisionException subtypeNotProvided(Class<? extends Provider<?>> providerType, Class<?> type)
toProvisionExceptionback to summary
public ProvisionException toProvisionException()

Returns this exception convered to a ProvisionException.