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 Details

    • Errors

      public Errors()
    • Errors

      public Errors( source)
  • Method Details

    • withSource

      public  source)
      Returns an instance that uses source as a reference point for newly added errors.
    • missingImplementation

      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:
      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.
    • 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

      public Errors bindingToProvider()
    • subtypeNotProvided

      public <? extends Provider<?>> providerType, <?> type)
    • notASubtype

      public <?> implementationType, <?> type)
    • recursiveImplementationType

      public Errors recursiveImplementationType()
    • recursiveProviderType

      public Errors recursiveProviderType()
    • missingRuntimeRetention

      public  source)
    • missingScopeAnnotation

      public Errors 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

      public Errors duplicateScopes(Scope existing, <? extends > annotationType, Scope scope)
    • voidProviderMethod

      public Errors voidProviderMethod()
    • missingConstantValues

      public Errors missingConstantValues()
    • cannotInjectInnerClass

      public <?> type)
    • duplicateBindingAnnotations

      public  member, <? extends > a, <? extends > b)
    • duplicateScopeAnnotations

      public <? extends > a, <? extends > b)
    • recursiveBinding

      public Errors recursiveBinding()
    • bindingAlreadySet

      public Errors bindingAlreadySet(Key<?> key,  source)
    • childBindingAlreadySet

      public Errors childBindingAlreadySet(Key<?> key)
    • errorInjectingMethod

      public  cause)
    • errorNotifyingTypeListener

      public Errors errorNotifyingTypeListener(TypeListenerBinding listener, TypeLiteral<?> type,  cause)
    • errorInjectingConstructor

      public  cause)
    • errorInProvider

      public  runtimeException)
    • errorInUserInjector

      public Errors errorInUserInjector(MembersInjector<?> listener, TypeLiteral<?> type,  cause)
    • errorNotifyingInjectionListener

      public Errors errorNotifyingInjectionListener(InjectionListener<?> listener, TypeLiteral<?> type,  cause)
    • exposedButNotBound

      public void exposedButNotBound(Key<?> key)
    • getMessagesFromThrowable

      public static < throwable)
    • errorInUserCode

      public  cause,  messageFormat, ... arguments)
    • cannotInjectRawProvider

      public Errors cannotInjectRawProvider()
    • cannotInjectRawMembersInjector

      public Errors cannotInjectRawMembersInjector()
    • cannotInjectTypeLiteralOf

      public  unsupportedType)
    • cannotInjectRawTypeLiteral

      public Errors cannotInjectRawTypeLiteral()
    • cannotSatisfyCircularDependency

      public <?> expectedType)
    • throwCreationExceptionIfErrorsExist

      public void throwCreationExceptionIfErrorsExist()
    • throwConfigurationExceptionIfErrorsExist

      public void throwConfigurationExceptionIfErrorsExist()
    • throwProvisionExceptionIfErrorsExist

      public void throwProvisionExceptionIfErrorsExist()
    • merge

      public <Message> messages)
    • merge

      public Errors merge(Errors moreErrors)
    • getSources

      public <> getSources()
    • throwIfNewErrors

      public void throwIfNewErrors(int expectedSize) throws ErrorsException
      Throws:
      ErrorsException
    • toException

      public ErrorsException toException()
    • hasErrors

      public boolean hasErrors()
    • addMessage

      public  messageFormat, ... arguments)
    • addMessage

      public Errors addMessage(Message message)
    • format

      public static  format( messageFormat, ... arguments)
    • getMessages

      public <Message> getMessages()
    • format

      public static  format( heading, <Message> errorMessages)
      Returns the formatted message for an exception with the specified messages.
    • checkForNull

      public <T> T checkForNull(T value,  source, Dependency<?> dependency) throws ErrorsException
      Returns value if it is non-null allowed to be null. Otherwise a message is added and an ErrorsException is thrown.
      Throws:
      ErrorsException
    • getOnlyCause

      public static  getOnlyCause(<Message> messages)
      Returns the cause throwable if there is exactly one cause in messages. 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)