Class EncounterImpl<T>

java.lang.Object
com.google.inject.internal.EncounterImpl<T>
All Implemented Interfaces:
TypeEncounter<T>

final class EncounterImpl<T> extends Object implements TypeEncounter<T>
  • Field Details

  • Constructor Details

  • Method Details

    • invalidate

      void invalidate()
    • getMembersInjectors

      com.google.common.collect.ImmutableSet<MembersInjector<? super T>> getMembersInjectors()
    • getInjectionListeners

      com.google.common.collect.ImmutableSet<InjectionListener<? super T>> getInjectionListeners()
    • register

      public void register(MembersInjector<? super T> membersInjector)
      Description copied from interface: TypeEncounter
      Registers a members injector for type I. Guice will use the members injector after its performed its own injections on an instance of I.
      Specified by:
      register in interface TypeEncounter<T>
    • register

      public void register(InjectionListener<? super T> injectionListener)
      Description copied from interface: TypeEncounter
      Registers an injection listener for type I. Guice will notify the listener after all injections have been performed on an instance of I.
      Specified by:
      register in interface TypeEncounter<T>
    • addError

      public void addError(String message, Object... arguments)
      Description copied from interface: TypeEncounter
      Records an error message for type I which will be presented to the user at a later time. Unlike throwing an exception, this enable us to continue configuring the Injector and discover more errors. Uses String.format(String, Object[]) to insert the arguments into the message.
      Specified by:
      addError in interface TypeEncounter<T>
    • addError

      public void addError(Throwable t)
      Description copied from interface: TypeEncounter
      Records an exception for type I, the full details of which will be logged, and the message of which will be presented to the user at a later time. If your type listener calls something that you worry may fail, you should catch the exception and pass it to this method.
      Specified by:
      addError in interface TypeEncounter<T>
    • addError

      public void addError(Message message)
      Description copied from interface: TypeEncounter
      Records an error message to be presented to the user at a later time.
      Specified by:
      addError in interface TypeEncounter<T>
    • getProvider

      public <T> Provider<T> getProvider(Key<T> key)
      Description copied from interface: TypeEncounter
      Returns the provider used to obtain instances for the given injection key. The returned provider will not be valid until the injector has been created. The provider will throw an IllegalStateException if you try to use it beforehand.
      Specified by:
      getProvider in interface TypeEncounter<T>
    • getProvider

      public <T> Provider<T> getProvider(Class<T> type)
      Description copied from interface: TypeEncounter
      Returns the provider used to obtain instances for the given injection type. The returned provider will not be valid until the injector has been created. The provider will throw an IllegalStateException if you try to use it beforehand.
      Specified by:
      getProvider in interface TypeEncounter<T>
    • getMembersInjector

      public <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> typeLiteral)
      Description copied from interface: TypeEncounter
      Returns the members injector used to inject dependencies into methods and fields on instances of the given type T. The returned members injector will not be valid until the main injector has been created. The members injector will throw an IllegalStateException if you try to use it beforehand.
      Specified by:
      getMembersInjector in interface TypeEncounter<T>
      Parameters:
      typeLiteral - type to get members injector for
    • getMembersInjector

      public <T> MembersInjector<T> getMembersInjector(Class<T> type)
      Description copied from interface: TypeEncounter
      Returns the members injector used to inject dependencies into methods and fields on instances of the given type T. The returned members injector will not be valid until the main injector has been created. The members injector will throw an IllegalStateException if you try to use it beforehand.
      Specified by:
      getMembersInjector in interface TypeEncounter<T>
      Parameters:
      type - type to get members injector for