Class InternalProvisionException
- All Implemented Interfaces:
Serializable
This is the internal dual of ProvisionException, similar to the relationship between
ConfigurationException and ErrorsException. This is useful for
several reasons:
- Since it is a checked exception, we get some assistance from the java compiler in ensuring that we correctly handle it everywhere. ProvisionException is unchecked.
- Since this is an internal package, we can add useful construction and mutation APIs that would be undesirable in a public supported API.
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).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.collect.ImmutableList<Message>private static final Loggerprivate static final Set<Dependency<?>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivateInternalProvisionException(Iterable<Message> errors) -
Method Summary
Modifier and TypeMethodDescription(package private) InternalProvisionExceptionPrepends the givensourceto the stack of binding sources for the errors reported in this exception.static InternalProvisionExceptioncannotProxyClass(Class<?> expectedType) static InternalProvisionExceptioncircularDependenciesDisabled(Class<?> expectedType) static InternalProvisionExceptionstatic InternalProvisionExceptionstatic InternalProvisionExceptionerrorInjectingMethod(Throwable cause) static InternalProvisionExceptionerrorInProvider(Throwable cause) static InternalProvisionExceptionerrorInUserCode(Throwable cause, String messageFormat, Object... arguments) static InternalProvisionExceptionerrorInUserInjector(MembersInjector<?> listener, TypeLiteral<?> type, RuntimeException cause) static InternalProvisionExceptionerrorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type, RuntimeException cause) (package private) com.google.common.collect.ImmutableList<Message>static InternalProvisionExceptionjitDisabled(Key<?> key) (package private) static voidonNullInjectedIntoNonNullableDependency(Object source, Dependency<?> dependency) Returnsvalueif it is non-null or allowed to be null.static InternalProvisionExceptionsubtypeNotProvided(Class<? extends javax.inject.Provider<?>> providerType, Class<?> type) Returns this exception convered to a ProvisionException.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
logger
-
warnedDependencies
-
sourcesToPrepend
-
errors
-
-
Constructor Details
-
InternalProvisionException
-
InternalProvisionException
-
-
Method Details
-
circularDependenciesDisabled
-
cannotProxyClass
-
create
-
errorInUserCode
public static InternalProvisionException errorInUserCode(Throwable cause, String messageFormat, Object... arguments) -
subtypeNotProvided
public static InternalProvisionException subtypeNotProvided(Class<? extends javax.inject.Provider<?>> providerType, Class<?> type) -
errorInProvider
-
errorInjectingMethod
-
errorInjectingConstructor
-
errorInUserInjector
public static InternalProvisionException errorInUserInjector(MembersInjector<?> listener, TypeLiteral<?> type, RuntimeException cause) -
jitDisabled
-
errorNotifyingInjectionListener
public static InternalProvisionException errorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type, RuntimeException cause) -
onNullInjectedIntoNonNullableDependency
static void onNullInjectedIntoNonNullableDependency(Object source, Dependency<?> dependency) throws InternalProvisionException Returnsvalueif it is non-null or allowed to be null. Otherwise a message is added and anInternalProvisionExceptionis thrown.- Throws:
InternalProvisionException
-
addSource
Prepends the givensourceto 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.
- Parameters:
source-- Returns:
this
-
getErrors
com.google.common.collect.ImmutableList<Message> getErrors() -
toProvisionException
Returns this exception convered to a ProvisionException.
-