Class Errors
org.elasticsearch.common.inject.internal.Errors
public final class Errors
extends
A collection of error messages. If this type is passed as a method parameter, the method is
considered to have executed successfully 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 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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionmessageFormat, ... arguments)
addMessage(Message message)
stringValue, source, TypeLiteral<?> type, MatcherAndConverter a, MatcherAndConverter b)
bindingAlreadySet(Key<?> key, source)
simpleName)
<?> type)
unsupportedType)
<?> expectedType)
<T> T
checkForNull(T value, source, Dependency<?> dependency)
Returnsvalue
if it is non-null allowed to be null.childBindingAlreadySet(Key<?> key)
stringValue, source, TypeLiteral<?> type, MatcherAndConverter matchingConverter, cause)
stringValue, source, TypeLiteral<?> type, MatcherAndConverter matchingConverter, converted)
static
o)
stringValue, source, TypeLiteral<?> type, MatcherAndConverter matchingConverter)
member, <? extends > a, <? extends > b)
<? extends > a, <? extends > b)
duplicateScopes(Scope existing, <? extends > annotationType, Scope scope)
cause)
cause)
runtimeException)
cause, messageFormat, ... arguments)
errorInUserInjector(MembersInjector<?> listener, TypeLiteral<?> type, cause)
errorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type, cause)
errorNotifyingTypeListener(TypeListenerBinding listener, TypeLiteral<?> type, cause)
void
exposedButNotBound(Key<?> key)
static
messageFormat, ... arguments)
static
heading, <Message> errorMessages)
Returns the formatted message for an exception with the specified messages.static void
formatter, Dependency<?> dependency, InjectionPoint injectionPoint)
static void
formatter, source)
<Message>
static <Message>
throwable)
static
<Message> messages)
Returns the cause throwable if there is exactly one cause inmessages
.<>
boolean
<Message> messages)
member, bindingAnnotation)
<?> implementation)
missingImplementation(Key key)
We use a fairly generic error message here.source)
<?> implementationType, <?> type)
constructor)
<? extends > scopeAnnotation, <?> type, source)
<? extends > scopeAnnotation)
int
size()
<? extends Provider<?>> providerType, <?> type)
void
void
void
throwIfNewErrors(int expectedSize)
void
<?> implementation)
source)
Returns an instance that usessource
as a reference point for newly added errors.Methods inherited from class java.lang.
, , , , , , , , , ,
-
Constructor Details
-
Errors
public Errors() -
Errors
public Errors( source)
-
-
Method Details
-
withSource
public source)Returns an instance that usessource
as a reference point for newly added errors. -
missingImplementation
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:Guice.createInjector(new AbstractModule() { public void configure() { bind(Runnable.class); } }
Otherwise we need to know who's calling when resolving a just-in-time binding, which makes things unnecessarily complex.Guice.createInjector().getInstance(Runnable.class);
-
converterReturnedNull
public stringValue, source, TypeLiteral<?> type, MatcherAndConverter matchingConverter) -
conversionTypeError
public stringValue, source, TypeLiteral<?> type, MatcherAndConverter matchingConverter, converted) -
conversionError
public stringValue, source, TypeLiteral<?> type, MatcherAndConverter matchingConverter, cause) -
ambiguousTypeConversion
public stringValue, source, TypeLiteral<?> type, MatcherAndConverter a, MatcherAndConverter b) -
bindingToProvider
-
subtypeNotProvided
public <? extends Provider<?>> providerType, <?> type) -
notASubtype
public <?> implementationType, <?> type) -
recursiveImplementationType
-
recursiveProviderType
-
missingRuntimeRetention
public source) -
missingScopeAnnotation
-
optionalConstructor
public constructor) -
cannotBindToGuiceType
public simpleName) -
scopeNotFound
public <? extends > scopeAnnotation) -
scopeAnnotationOnAbstractType
public <? extends > scopeAnnotation, <?> type, source) -
misplacedBindingAnnotation
public member, bindingAnnotation) -
missingConstructor
public <?> implementation) -
tooManyConstructors
public <?> implementation) -
duplicateScopes
-
voidProviderMethod
-
missingConstantValues
-
cannotInjectInnerClass
public <?> type) -
duplicateBindingAnnotations
public member, <? extends > a, <? extends > b) -
duplicateScopeAnnotations
public <? extends > a, <? extends > b) -
recursiveBinding
-
bindingAlreadySet
-
childBindingAlreadySet
-
errorInjectingMethod
public cause) -
errorNotifyingTypeListener
-
errorInjectingConstructor
public cause) -
errorInProvider
public runtimeException) -
errorInUserInjector
-
errorNotifyingInjectionListener
public Errors errorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type, cause) -
exposedButNotBound
-
getMessagesFromThrowable
public static < throwable) -
errorInUserCode
public cause, messageFormat, ... arguments) -
cannotInjectRawProvider
-
cannotInjectRawMembersInjector
-
cannotInjectTypeLiteralOf
public unsupportedType) -
cannotInjectRawTypeLiteral
-
cannotSatisfyCircularDependency
public <?> expectedType) -
throwCreationExceptionIfErrorsExist
public void throwCreationExceptionIfErrorsExist() -
throwConfigurationExceptionIfErrorsExist
public void throwConfigurationExceptionIfErrorsExist() -
throwProvisionExceptionIfErrorsExist
public void throwProvisionExceptionIfErrorsExist() -
merge
public <Message> messages) -
merge
-
getSources
public <> getSources() -
throwIfNewErrors
- Throws:
ErrorsException
-
toException
-
hasErrors
public boolean hasErrors() -
addMessage
public messageFormat, ... arguments) -
addMessage
-
format
public static format( messageFormat, ... arguments) -
getMessages
-
format
Returns the formatted message for an exception with the specified messages. -
checkForNull
Returnsvalue
if it is non-null allowed to be null. Otherwise a message is added and anErrorsException
is thrown.- Throws:
ErrorsException
-
getOnlyCause
Returns the cause throwable if there is exactly one cause inmessages
. If there are zero or multiple messages with causes, null is returned. -
size
public int size() -
convert
public static convert( o) -
formatSource
public static void formatSource( formatter, source) -
formatInjectionPoint
public static void formatInjectionPoint( formatter, Dependency<?> dependency, InjectionPoint injectionPoint)
-