public final class InternalProvisionException
extends java.lang.Exception
This is the internal dual of ProvisionException
, similar to the relationship between
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(java.lang.Throwable, java.lang.String, java.lang.Object...)
is called with an exception that holds multiple errors (like
ProvisionException).
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableList<Message> |
errors |
private static java.util.logging.Logger |
logger |
private java.util.List<java.lang.Object> |
sourcesToPrepend |
private static java.util.Set<Dependency<?>> |
warnedDependencies |
Modifier | Constructor and Description |
---|---|
private |
InternalProvisionException(java.lang.Iterable<Message> errors) |
private |
InternalProvisionException(Message error) |
Modifier and Type | Method and Description |
---|---|
(package private) InternalProvisionException |
addSource(java.lang.Object source)
Prepends the given
source to the stack of binding sources for the errors reported in
this exception. |
static InternalProvisionException |
cannotProxyClass(java.lang.Class<?> expectedType) |
static InternalProvisionException |
circularDependenciesDisabled(java.lang.Class<?> expectedType) |
static InternalProvisionException |
create(java.lang.String format,
java.lang.Object... arguments) |
static InternalProvisionException |
errorInjectingConstructor(java.lang.Throwable cause) |
static InternalProvisionException |
errorInjectingMethod(java.lang.Throwable cause) |
static InternalProvisionException |
errorInProvider(java.lang.Throwable cause) |
static InternalProvisionException |
errorInUserCode(java.lang.Throwable cause,
java.lang.String messageFormat,
java.lang.Object... arguments) |
static InternalProvisionException |
errorInUserInjector(MembersInjector<?> listener,
TypeLiteral<?> type,
java.lang.RuntimeException cause) |
static InternalProvisionException |
errorNotifyingInjectionListener(InjectionListener<?> listener,
TypeLiteral<?> type,
java.lang.RuntimeException cause) |
(package private) com.google.common.collect.ImmutableList<Message> |
getErrors() |
static InternalProvisionException |
jitDisabled(Key<?> key) |
(package private) static void |
onNullInjectedIntoNonNullableDependency(java.lang.Object source,
Dependency<?> dependency)
Returns
value if it is non-null or allowed to be null. |
static InternalProvisionException |
subtypeNotProvided(java.lang.Class<? extends javax.inject.Provider<?>> providerType,
java.lang.Class<?> type) |
ProvisionException |
toProvisionException()
Returns this exception convered to a ProvisionException.
|
private static final java.util.logging.Logger logger
private static final java.util.Set<Dependency<?>> warnedDependencies
private final java.util.List<java.lang.Object> sourcesToPrepend
private final com.google.common.collect.ImmutableList<Message> errors
private InternalProvisionException(Message error)
private InternalProvisionException(java.lang.Iterable<Message> errors)
public static InternalProvisionException circularDependenciesDisabled(java.lang.Class<?> expectedType)
public static InternalProvisionException cannotProxyClass(java.lang.Class<?> expectedType)
public static InternalProvisionException create(java.lang.String format, java.lang.Object... arguments)
public static InternalProvisionException errorInUserCode(java.lang.Throwable cause, java.lang.String messageFormat, java.lang.Object... arguments)
public static InternalProvisionException subtypeNotProvided(java.lang.Class<? extends javax.inject.Provider<?>> providerType, java.lang.Class<?> type)
public static InternalProvisionException errorInProvider(java.lang.Throwable cause)
public static InternalProvisionException errorInjectingMethod(java.lang.Throwable cause)
public static InternalProvisionException errorInjectingConstructor(java.lang.Throwable cause)
public static InternalProvisionException errorInUserInjector(MembersInjector<?> listener, TypeLiteral<?> type, java.lang.RuntimeException cause)
public static InternalProvisionException jitDisabled(Key<?> key)
public static InternalProvisionException errorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type, java.lang.RuntimeException cause)
static void onNullInjectedIntoNonNullableDependency(java.lang.Object source, Dependency<?> dependency) throws InternalProvisionException
value
if it is non-null or allowed to be null. Otherwise a message is added and
an InternalProvisionException
is thrown.InternalProvisionException
InternalProvisionException addSource(java.lang.Object source)
source
to the stack of binding sources for the errors reported in
this exception.
It is expected that this method is called as the exception propagates up the stack.
source
- this
com.google.common.collect.ImmutableList<Message> getErrors()
public ProvisionException toProvisionException()