|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.elasticsearch.common.inject.internal.Errors
public final class Errors
A collection of error messages. If this type is passed as a method parameter, the method is considered to have executed succesfully only if new errors were not added to this collection.
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.
Constructor Summary | |
---|---|
Errors()
|
|
Errors(Object source)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Errors()
public Errors(Object source)
Method Detail |
---|
public Errors withSource(Object source)
source
as a reference point for newly added errors.
public Errors missingImplementation(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 Errors converterReturnedNull(String stringValue, Object source, TypeLiteral<?> type, MatcherAndConverter matchingConverter)
public Errors conversionTypeError(String stringValue, Object source, TypeLiteral<?> type, MatcherAndConverter matchingConverter, Object converted)
public Errors conversionError(String stringValue, Object source, TypeLiteral<?> type, MatcherAndConverter matchingConverter, RuntimeException cause)
public Errors ambiguousTypeConversion(String stringValue, Object source, TypeLiteral<?> type, MatcherAndConverter a, MatcherAndConverter b)
public Errors bindingToProvider()
public Errors subtypeNotProvided(Class<? extends Provider<?>> providerType, Class<?> type)
public Errors notASubtype(Class<?> implementationType, Class<?> type)
public Errors recursiveImplementationType()
public Errors recursiveProviderType()
public Errors missingRuntimeRetention(Object source)
public Errors missingScopeAnnotation()
public Errors optionalConstructor(Constructor constructor)
public Errors cannotBindToGuiceType(String simpleName)
public Errors scopeNotFound(Class<? extends Annotation> scopeAnnotation)
public Errors scopeAnnotationOnAbstractType(Class<? extends Annotation> scopeAnnotation, Class<?> type, Object source)
public Errors misplacedBindingAnnotation(Member member, Annotation bindingAnnotation)
public Errors missingConstructor(Class<?> implementation)
public Errors tooManyConstructors(Class<?> implementation)
public Errors duplicateScopes(Scope existing, Class<? extends Annotation> annotationType, Scope scope)
public Errors voidProviderMethod()
public Errors missingConstantValues()
public Errors cannotInjectInnerClass(Class<?> type)
public Errors duplicateBindingAnnotations(Member member, Class<? extends Annotation> a, Class<? extends Annotation> b)
public Errors duplicateScopeAnnotations(Class<? extends Annotation> a, Class<? extends Annotation> b)
public Errors recursiveBinding()
public Errors bindingAlreadySet(Key<?> key, Object source)
public Errors childBindingAlreadySet(Key<?> key)
public Errors errorInjectingMethod(Throwable cause)
public Errors errorNotifyingTypeListener(TypeListenerBinding listener, TypeLiteral<?> type, Throwable cause)
public Errors errorInjectingConstructor(Throwable cause)
public Errors errorInProvider(RuntimeException runtimeException)
public Errors errorInUserInjector(MembersInjector<?> listener, TypeLiteral<?> type, RuntimeException cause)
public Errors errorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type, RuntimeException cause)
public void exposedButNotBound(Key<?> key)
public static Collection<Message> getMessagesFromThrowable(Throwable throwable)
public Errors errorInUserCode(Throwable cause, String messageFormat, Object... arguments)
public Errors cannotInjectRawProvider()
public Errors cannotInjectRawMembersInjector()
public Errors cannotInjectTypeLiteralOf(Type unsupportedType)
public Errors cannotInjectRawTypeLiteral()
public Errors cannotSatisfyCircularDependency(Class<?> expectedType)
public void throwCreationExceptionIfErrorsExist()
public void throwConfigurationExceptionIfErrorsExist()
public void throwProvisionExceptionIfErrorsExist()
public Errors merge(Collection<Message> messages)
public Errors merge(Errors moreErrors)
public List<Object> getSources()
public void throwIfNewErrors(int expectedSize) throws ErrorsException
ErrorsException
public ErrorsException toException()
public boolean hasErrors()
public Errors addMessage(String messageFormat, Object... arguments)
public Errors addMessage(Message message)
public static String format(String messageFormat, Object... arguments)
public List<Message> getMessages()
public static String format(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 Throwable getOnlyCause(Collection<Message> messages)
messages
. If there are
zero or multiple messages with causes, null is returned.
public int size()
public static Object convert(Object o)
public static void formatSource(Formatter formatter, Object source)
public static void formatInjectionPoint(Formatter formatter, Dependency<?> dependency, InjectionPoint injectionPoint)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |