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 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.
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, TypeConverterBinding typeConverterBinding)
public ErrorsconversionTypeError(String stringValue, Object source, TypeLiteral <?> type, TypeConverterBinding typeConverterBinding, Object converted)
public ErrorsconversionError(String stringValue, Object source, TypeLiteral <?> type, TypeConverterBinding typeConverterBinding, RuntimeException cause)
public ErrorsambiguousTypeConversion(String stringValue, Object source, TypeLiteral <?> type, TypeConverterBinding a, TypeConverterBinding b)
public ErrorsbindingToProvider()
public ErrorssubtypeNotProvided(Class <? extends Provider <?>> providerType, Class <?> type)
public ErrorsrecursiveImplementationType()
public ErrorsrecursiveProviderType()
public ErrorsmissingRuntimeRetention(Class <? extends Annotation > annotation)
public ErrorsmissingScopeAnnotation(Class <? extends Annotation > annotation)
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 ErrorsconstructorNotDefinedByType(Constructor <?> constructor, TypeLiteral <?> type)
public ErrorsduplicateScopes(ScopeBinding existing, Class <? extends Annotation > annotationType, Scope scope)
public ErrorsvoidProviderMethod()
public ErrorsmissingConstantValues()
public ErrorsduplicateBindingAnnotations(Member member, Class <? extends Annotation > a, Class <? extends Annotation > b)
public ErrorscannotInjectMethodWithTypeParameters(Method method)
public ErrorsduplicateScopeAnnotations(Class <? extends Annotation > a, Class <? extends Annotation > b)
public ErrorsrecursiveBinding()
public ErrorserrorCheckingDuplicateBinding(Key <?> key, Object source, Throwable t)
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 ErrorskeyNotFullySpecified(TypeLiteral <?> typeLiteral)
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 Objectconvert(Object o, ElementSource source)
public static void formatSource(Formatterformatter, Object source, ElementSource elementSource)
public static void formatInjectionPoint(Formatterformatter, Dependency <?> dependency, InjectionPoint injectionPoint, ElementSource elementSource)