Errors can be chained to provide additional context. To add context, call withSource
to create a new Errors instance that contains additional context. All messages added to the
returned instance will contain full context.
To avoid messages with redundant context, withSource should be added sparingly. A
good rule of thumb is to assume a method's caller has already specified enough context to
identify that method. When calling a method that's defined in a different context, call that
method with an errors object that includes its context.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private List | errors
null unless (root == this) and error messages exist. |
| private final Errors | parent
The parent errors object. |
| private final Errors | root
The root errors object. |
| private final Object | source
The leaf source for errors added here. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Errors | |
| public Errors | |
| private Errors | |
| public Errors | |
| public Errors | ambiguousTypeConversion(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding a, TypeConverterBinding b)
|
| public Errors | |
| public Errors | |
| public Errors | |
| pack-priv Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| pack-priv static void | checkConfiguration(boolean condition, String format, Object... args)
Throws a ConfigurationException with a formatted |
| pack-priv static <T> T | checkNotNull(T reference, String name)
Throws a ConfigurationException with an NullPointerExceptions as the cause if the given
reference is |
| public Errors | |
| public Errors | |
| public Errors | conversionError(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding typeConverterBinding, RuntimeException cause)
|
| public Errors | conversionTypeError(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding typeConverterBinding, Object converted)
|
| public static Object | |
| public static Object | |
| public Errors | converterReturnedNull(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding typeConverterBinding)
|
| public Errors | duplicateBindingAnnotations(Member member, Class<? extends Annotation> a, Class<? extends Annotation> b)
|
| public <K, V> Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public static String | |
| public static void | |
| public List | |
| public static Collection | |
| private List | |
| public boolean | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| pack-priv <T> Errors | missingImplementationWithHint(Key<T> key, Injector injector)
Within guice's core, allow for better missing binding messages |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | |
| public Errors | requestInjectionWithDifferentTypes(Object instance, TypeLiteral<?> type1, Object type1Source, TypeLiteral<?> type2)
|
| public Errors | scopeAnnotationOnAbstractType(Class<? extends Annotation> scopeAnnotation, Class<?> type, Object source)
|
| public Errors | |
| public int | |
| public Errors | |
| public void | |
| public void | |
| public void | |
| public void | |
| public ErrorsException | |
| public Errors | |
| public Errors | |
| public Errors | withSource(Object source)
Returns an instance that uses |
| CONSTRUCTOR_RULES | back to summary |
|---|---|
| private static final String CONSTRUCTOR_RULES | |
| errors | back to summary |
|---|---|
| private List<Message> errors null unless (root == this) and error messages exist. Never an empty list. | |
| parent | back to summary |
|---|---|
| private final Errors parent The parent errors object. Used to obtain the chain of source objects. | |
| root | back to summary |
|---|---|
| private final Errors root The root errors object. Used to access the list of error messages. | |
| source | back to summary |
|---|---|
| private final Object source The leaf source for errors added here. | |
| Errors | back to summary |
|---|---|
| public Errors() | |
| Errors | back to summary |
|---|---|
| public Errors(Object source) | |
| Errors | back to summary |
|---|---|
| private Errors(Errors parent, Object source) | |
| addMessage | back to summary |
|---|---|
| public Errors addMessage(String messageFormat, Object... arguments) | |
| addMessage | back to summary |
|---|---|
| public Errors addMessage(ErrorId errorId, String messageFormat, Object... arguments) | |
| addMessage | back to summary |
|---|---|
| private Errors addMessage(ErrorId errorId, Throwable cause, String messageFormat, Object... arguments) | |
| addMessage | back to summary |
|---|---|
| public Errors addMessage(Message message) | |
| ambiguousTypeConversion | back to summary |
|---|---|
| public Errors ambiguousTypeConversion(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding a, TypeConverterBinding b) | |
| aopDisabled | back to summary |
|---|---|
| public Errors aopDisabled(InterceptorBinding binding) | |
| atInjectRequired | back to summary |
|---|---|
| public Errors atInjectRequired(TypeLiteral<?> type) | |
| atTargetIsMissingParameter | back to summary |
|---|---|
| public Errors atTargetIsMissingParameter(Annotation bindingAnnotation, String parameterName, Class<?> clazz) | |
| bindingAlreadySet | back to summary |
|---|---|
| pack-priv Errors bindingAlreadySet(Binding<?> binding, Binding<?> original) | |
| bindingAlreadySet | back to summary |
|---|---|
| public Errors bindingAlreadySet(Key<?> key, Object source) | |
| bindingToProvider | back to summary |
|---|---|
| public Errors bindingToProvider() | |
| cannotBindToGuiceType | back to summary |
|---|---|
| public Errors cannotBindToGuiceType(String simpleName) | |
| cannotInjectAbstractMethod | back to summary |
|---|---|
| public Errors cannotInjectAbstractMethod(Method method) | |
| cannotInjectFinalField | back to summary |
|---|---|
| public Errors cannotInjectFinalField(Field field) | |
| cannotInjectInnerClass | back to summary |
|---|---|
| public Errors cannotInjectInnerClass(Class<?> type) | |
| cannotInjectLocalClass | back to summary |
|---|---|
| public Errors cannotInjectLocalClass(Class<?> type) | |
| cannotInjectMethodWithTypeParameters | back to summary |
|---|---|
| public Errors cannotInjectMethodWithTypeParameters(Method method) | |
| cannotInjectRawMembersInjector | back to summary |
|---|---|
| public Errors cannotInjectRawMembersInjector() | |
| cannotInjectRawProvider | back to summary |
|---|---|
| public Errors cannotInjectRawProvider() | |
| cannotInjectRawTypeLiteral | back to summary |
|---|---|
| public Errors cannotInjectRawTypeLiteral() | |
| cannotInjectTypeLiteralOf | back to summary |
|---|---|
| public Errors cannotInjectTypeLiteralOf(Type unsupportedType) | |
| checkConfiguration | back to summary |
|---|---|
| pack-priv static void checkConfiguration(boolean condition, String format, Object... args) Throws a ConfigurationException with a formatted | |
| checkNotNull | back to summary |
|---|---|
| pack-priv static <T> T checkNotNull(T reference, String name) Throws a ConfigurationException with an NullPointerExceptions as the cause if the given
reference is | |
| childBindingAlreadySet | back to summary |
|---|---|
| public Errors childBindingAlreadySet(Key<?> key, Set<Object> sources) | |
| constructorNotDefinedByType | back to summary |
|---|---|
| public Errors constructorNotDefinedByType(Constructor<?> constructor, TypeLiteral<?> type) | |
| conversionError | back to summary |
|---|---|
| public Errors conversionError(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding typeConverterBinding, RuntimeException cause) | |
| conversionTypeError | back to summary |
|---|---|
| public Errors conversionTypeError(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding typeConverterBinding, Object converted) | |
| convert | back to summary |
|---|---|
| public static Object convert(Object o) | |
| convert | back to summary |
|---|---|
| public static Object convert(Object o, ElementSource source) | |
| converterReturnedNull | back to summary |
|---|---|
| public Errors converterReturnedNull(String stringValue, Object source, TypeLiteral<?> type, TypeConverterBinding typeConverterBinding) | |
| duplicateBindingAnnotations | back to summary |
|---|---|
| public Errors duplicateBindingAnnotations(Member member, Class<? extends Annotation> a, Class<? extends Annotation> b) | |
| duplicateMapKey | back to summary |
|---|---|
| public <K, V> Errors duplicateMapKey(Key<Map<K, V>> mapKey, Multimap<K, Binding<V>> duplicates) | |
| duplicateScopeAnnotations | back to summary |
|---|---|
| public Errors duplicateScopeAnnotations(Class<? extends Annotation> a, Class<? extends Annotation> b) | |
| duplicateScopes | back to summary |
|---|---|
| public Errors duplicateScopes(ScopeBinding existing, Class<? extends Annotation> annotationType, Scope scope) | |
| errorCheckingDuplicateBinding | back to summary |
|---|---|
| public Errors errorCheckingDuplicateBinding(Key<?> key, Object source, Throwable t) | |
| errorEnhancingClass | back to summary |
|---|---|
| public Errors errorEnhancingClass(Class<?> clazz, Throwable cause) | |
| errorInUserCode | back to summary |
|---|---|
| public Errors errorInUserCode(Throwable cause, String messageFormat, Object... arguments) | |
| errorNotifyingTypeListener | back to summary |
|---|---|
| public Errors errorNotifyingTypeListener(TypeListenerBinding listener, TypeLiteral<?> type, Throwable cause) | |
| exposedButNotBound | back to summary |
|---|---|
| public Errors exposedButNotBound(Key<?> key) | |
| format | back to summary |
|---|---|
| public static String format(String messageFormat, Object... arguments) | |
| formatSource | back to summary |
|---|---|
| public static void formatSource(Formatter formatter, Object source) | |
| getMessages | back to summary |
|---|---|
| public List | |
| getMessagesFromThrowable | back to summary |
|---|---|
| public static Collection | |
| getSources | back to summary |
|---|---|
| private List | |
| hasErrors | back to summary |
|---|---|
| public boolean hasErrors() | |
| jitBindingAlreadySet | back to summary |
|---|---|
| public Errors jitBindingAlreadySet(Key<?> key) | |
| jitDisabled | back to summary |
|---|---|
| public Errors jitDisabled(Key<?> key) | |
| jitDisabledInParent | back to summary |
|---|---|
| public Errors jitDisabledInParent(Key<?> key) | |
| keyNotFullySpecified | back to summary |
|---|---|
| public Errors keyNotFullySpecified(TypeLiteral<?> typeLiteral) | |
| merge | back to summary |
|---|---|
| public Errors merge(Collection<Message> messages) | |
| merge | back to summary |
|---|---|
| public Errors merge(Errors moreErrors) | |
| merge | back to summary |
|---|---|
| public Errors merge(InternalProvisionException ipe) | |
| misplacedBindingAnnotation | back to summary |
|---|---|
| public Errors misplacedBindingAnnotation(Member member, Annotation bindingAnnotation) | |
| missingConstantValues | back to summary |
|---|---|
| public Errors missingConstantValues() | |
| missingConstructor | back to summary |
|---|---|
| public Errors missingConstructor(TypeLiteral<?> type) | |
| missingImplementation | back to summary |
|---|---|
| public Errors missingImplementation(Key<?> key) We use a fairly generic error message here. The motivation is to share the same message for both bind time errors:
...and at provide-time errors:
Otherwise we need to know who's calling when resolving a just-in-time binding, which makes
things unnecessarily complex.
| |
| missingImplementationWithHint | back to summary |
|---|---|
| pack-priv <T> Errors missingImplementationWithHint(Key<T> key, Injector injector) Within guice's core, allow for better missing binding messages | |
| missingRuntimeRetention | back to summary |
|---|---|
| public Errors missingRuntimeRetention(Class<? extends Annotation> annotation) | |
| missingScopeAnnotation | back to summary |
|---|---|
| public Errors missingScopeAnnotation(Class<? extends Annotation> annotation) | |
| notASubtype | back to summary |
|---|---|
| public Errors notASubtype(Class<?> implementationType, Class<?> type) | |
| optionalConstructor | back to summary |
|---|---|
| public Errors optionalConstructor(Constructor<?> constructor) | |
| recursiveBinding | back to summary |
|---|---|
| public Errors recursiveBinding(Key<?> key, Key<?> linkedKey) | |
| recursiveImplementationType | back to summary |
|---|---|
| public Errors recursiveImplementationType() | |
| recursiveProviderType | back to summary |
|---|---|
| public Errors recursiveProviderType() | |
| requestInjectionWithDifferentTypes | back to summary |
|---|---|
| public Errors requestInjectionWithDifferentTypes(Object instance, TypeLiteral<?> type1, Object type1Source, TypeLiteral<?> type2) | |
| scopeAnnotationOnAbstractType | back to summary |
|---|---|
| public Errors scopeAnnotationOnAbstractType(Class<? extends Annotation> scopeAnnotation, Class<?> type, Object source) | |
| scopeNotFound | back to summary |
|---|---|
| public Errors scopeNotFound(Class<? extends Annotation> scopeAnnotation) | |
| size | back to summary |
|---|---|
| public int size() | |
| staticInjectionOnInterface | back to summary |
|---|---|
| public Errors staticInjectionOnInterface(Class<?> clazz) | |
| throwConfigurationExceptionIfErrorsExist | back to summary |
|---|---|
| public void throwConfigurationExceptionIfErrorsExist() | |
| throwCreationExceptionIfErrorsExist | back to summary |
|---|---|
| public void throwCreationExceptionIfErrorsExist() | |
| throwIfNewErrors | back to summary |
|---|---|
| public void throwIfNewErrors(int expectedSize) throws ErrorsException | |
| throwProvisionExceptionIfErrorsExist | back to summary |
|---|---|
| public void throwProvisionExceptionIfErrorsExist() | |
| toException | back to summary |
|---|---|
| public ErrorsException toException() | |
| tooManyConstructors | back to summary |
|---|---|
| public Errors tooManyConstructors(Class<?> implementation) | |
| voidProviderMethod | back to summary |
|---|---|
| public Errors voidProviderMethod() | |
| withSource | back to summary |
|---|---|
| public Errors withSource(Object source) Returns an instance that uses | |