public final class Errors extends Objectimplements Serializable
Errors can be chained to provide additional context. To add context, call withSource(java.lang.Object) 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(java.lang.Object) should be added sparingly. A good rule of thumb is to assume a ethod'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.
public Errors()
public Errors(Objectsource)
public ErrorswithSource(Object source)
source as a reference point for newly added errors.
public ErrorsmissingImplementation(Key key)
Guice.createInjector(new AbstractModule() {
public void configure() {
bind(Runnable.class);
}
} ...and at provide-time errors:
Guice.createInjector().getInstance(Runnable.class); Otherwise we need to know who's calling when resolving a just-in-time binding, which makes things unnecessarily complex.
public ErrorsconverterReturnedNull(String stringValue, Object source, TypeLiteral <?> type, MatcherAndConverter matchingConverter)
public ErrorsconversionTypeError(String stringValue, Object source, TypeLiteral <?> type, MatcherAndConverter matchingConverter, Object converted)
public ErrorsconversionError(String stringValue, Object source, TypeLiteral <?> type, MatcherAndConverter matchingConverter, RuntimeException cause)
public ErrorsambiguousTypeConversion(String stringValue, Object source, TypeLiteral <?> type, MatcherAndConverter a, MatcherAndConverter b)
public ErrorsbindingToProvider()
public ErrorssubtypeNotProvided(Class <? extends Provider <?>> providerType, Class <?> type)
public ErrorsrecursiveImplementationType()
public ErrorsrecursiveProviderType()
public ErrorsmissingScopeAnnotation()
public ErrorsoptionalConstructor(Constructor constructor)
public ErrorsscopeNotFound(Class <? extends Annotation > scopeAnnotation)
public ErrorsscopeAnnotationOnAbstractType(Class <? extends Annotation > scopeAnnotation, Class <?> type, Object source)
public ErrorsmisplacedBindingAnnotation(Member member, Annotation bindingAnnotation)
public ErrorsduplicateScopes(Scope existing, Class <? extends Annotation > annotationType, Scope scope)
public ErrorsvoidProviderMethod()
public ErrorsmissingConstantValues()
public ErrorsduplicateBindingAnnotations(Member member, Class <? extends Annotation > a, Class <? extends Annotation > b)
public ErrorsduplicateScopeAnnotations(Class <? extends Annotation > a, Class <? extends Annotation > b)
public ErrorsrecursiveBinding()
public ErrorserrorNotifyingTypeListener(TypeListenerBinding listener, TypeLiteral <?> type, Throwable cause)
public ErrorserrorInProvider(RuntimeException runtimeException)
public ErrorserrorInUserInjector(MembersInjector <?> listener, TypeLiteral <?> type, RuntimeException cause)
public ErrorserrorNotifyingInjectionListener(InjectionListener <?> listener, TypeLiteral <?> type, RuntimeException cause)
public void exposedButNotBound(Key<?> key)
public static Collection<Message > getMessagesFromThrowable(Throwable throwable)
public ErrorserrorInUserCode(Throwable cause, String messageFormat, Object ... arguments)
public ErrorscannotInjectRawProvider()
public ErrorscannotInjectRawMembersInjector()
public ErrorscannotInjectRawTypeLiteral()
public void throwCreationExceptionIfErrorsExist()
public void throwConfigurationExceptionIfErrorsExist()
public void throwProvisionExceptionIfErrorsExist()
public Errorsmerge(Collection <Message > messages)
public void throwIfNewErrors(int expectedSize)
throws ErrorsException
ErrorsException
public ErrorsExceptiontoException()
public boolean hasErrors()
public static Stringformat(String heading, Collection <Message > errorMessages)
public <T> T checkForNull(T value,
Object source,
Dependency<?> dependency)
throws ErrorsException
value if it is non-null allowed to be null. Otherwise a message is added and an
ErrorsException is thrown.
ErrorsException
public static ThrowablegetOnlyCause(Collection <Message > messages)
messages. If there are zero or multiple messages with causes, null is returned.
public int size()
public static void formatInjectionPoint(Formatterformatter, Dependency <?> dependency, InjectionPoint injectionPoint)