Top Fields Constructors Methods
com.google.inject.internal

pack-priv final Class EncounterImpl<T>

extends Object
implements TypeEncounter<T>
Class Inheritance
All Implemented Interfaces
com.google.inject.spi.TypeEncounter
Static Imports
com.google.common.base.Preconditions.checkState

Author
[email protected] (Jesse Wilson)

Field Summary

Modifier and TypeField and Description
private List<MethodAspect>
private final Errors
private List<InjectionListener<? super T>>
private final Lookups
private List<MembersInjector<? super T>>
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv
EncounterImpl(Errors errors, Lookups lookups)

Method Summary

Modifier and TypeMethod and Description
public void
addError(String message, Object... arguments)

Implements com.google.inject.spi.TypeEncounter.addError.

Records an error message for type I which will be presented to the user at a later time.
public void
addError(Throwable t)

Implements com.google.inject.spi.TypeEncounter.addError.

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.
public void
addError(Message message)

Implements com.google.inject.spi.TypeEncounter.addError.

Records an error message to be presented to the user at a later time.
public void
bindInterceptor(Matcher<? super Method>
matches methods the interceptor should apply to. For example: annotatedWith(Transactional.class).
methodMatcher
,
MethodInterceptor...
to bind
interceptors
)

Implements com.google.inject.spi.TypeEncounter.bindInterceptor.

Binds method interceptor[s] to methods matched in type I and its supertypes.
pack-priv ImmutableList<MethodAspect>
pack-priv ImmutableSet<InjectionListener<? super T>>
public <T> MembersInjector<T>
getMembersInjector(TypeLiteral<T>
type to get members injector for
typeLiteral
)

Implements com.google.inject.spi.TypeEncounter.getMembersInjector.

Returns the members injector used to inject dependencies into methods and fields on instances of the given type T.
public <T> MembersInjector<T>
getMembersInjector(Class<T>
type to get members injector for
type
)

Implements com.google.inject.spi.TypeEncounter.getMembersInjector.

Returns the members injector used to inject dependencies into methods and fields on instances of the given type T.
pack-priv ImmutableSet<MembersInjector<? super T>>
public <T> Provider<T>
getProvider(Key<T> key)

Implements com.google.inject.spi.TypeEncounter.getProvider.

Returns the provider used to obtain instances for the given injection key.
public <T> Provider<T>
getProvider(Class<T> type)

Implements com.google.inject.spi.TypeEncounter.getProvider.

Returns the provider used to obtain instances for the given injection type.
pack-priv void
public void
register(MembersInjector<? super T> membersInjector)

Implements com.google.inject.spi.TypeEncounter.register.

Registers a members injector for type I.
public void
register(InjectionListener<? super T> injectionListener)

Implements com.google.inject.spi.TypeEncounter.register.

Registers an injection listener for type I.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aspectsback to summary
private List<MethodAspect> aspects
errorsback to summary
private final Errors errors
injectionListenersback to summary
private List<InjectionListener<? super T>> injectionListeners
lookupsback to summary
private final Lookups lookups
membersInjectorsback to summary
private List<MembersInjector<? super T>> membersInjectors
validback to summary
private boolean valid

Constructor Detail

EncounterImplback to summary
pack-priv EncounterImpl(Errors errors, Lookups lookups)

Method Detail

addErrorback to summary
public void addError(String message, Object... arguments)

Implements com.google.inject.spi.TypeEncounter.addError.

Doc from com.google.inject.spi.TypeEncounter.addError.

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.

Annotations
@Override
addErrorback to summary
public void addError(Throwable t)

Implements com.google.inject.spi.TypeEncounter.addError.

Doc from com.google.inject.spi.TypeEncounter.addError.

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.

Annotations
@Override
addErrorback to summary
public void addError(Message message)

Implements com.google.inject.spi.TypeEncounter.addError.

Doc from com.google.inject.spi.TypeEncounter.addError.

Records an error message to be presented to the user at a later time.

Annotations
@Override
bindInterceptorback to summary
public void bindInterceptor(Matcher<? super Method> methodMatcher, MethodInterceptor... interceptors)

Implements com.google.inject.spi.TypeEncounter.bindInterceptor.

Doc from com.google.inject.spi.TypeEncounter.bindInterceptor.

Binds method interceptor[s] to methods matched in type I and its supertypes. A method is eligible for interception if:

  • Guice created the instance the method is on
  • Neither the enclosing type nor the method is final
  • And the method is package-private or more accessible
Parameters
methodMatcher:Matcher<? super Method>

matches methods the interceptor should apply to. For example: annotatedWith(Transactional.class).

interceptors:MethodInterceptor[]

to bind

Annotations
@Override
getAspectsback to summary
pack-priv ImmutableList<MethodAspect> getAspects()
getInjectionListenersback to summary
pack-priv ImmutableSet<InjectionListener<? super T>> getInjectionListeners()
getMembersInjectorback to summary
public <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> typeLiteral)

Implements com.google.inject.spi.TypeEncounter.getMembersInjector.

Doc from com.google.inject.spi.TypeEncounter.getMembersInjector.

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.

Parameters
typeLiteral:TypeLiteral<T>

type to get members injector for

Annotations
@Override
getMembersInjectorback to summary
public <T> MembersInjector<T> getMembersInjector(Class<T> type)

Implements com.google.inject.spi.TypeEncounter.getMembersInjector.

Doc from com.google.inject.spi.TypeEncounter.getMembersInjector.

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.

Parameters
type:Class<T>

type to get members injector for

Annotations
@Override
getMembersInjectorsback to summary
pack-priv ImmutableSet<MembersInjector<? super T>> getMembersInjectors()
getProviderback to summary
public <T> Provider<T> getProvider(Key<T> key)

Implements com.google.inject.spi.TypeEncounter.getProvider.

Doc from com.google.inject.spi.TypeEncounter.getProvider.

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.

Annotations
@Override
getProviderback to summary
public <T> Provider<T> getProvider(Class<T> type)

Implements com.google.inject.spi.TypeEncounter.getProvider.

Doc from com.google.inject.spi.TypeEncounter.getProvider.

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.

Annotations
@Override
invalidateback to summary
pack-priv void invalidate()
registerback to summary
public void register(MembersInjector<? super T> membersInjector)

Implements com.google.inject.spi.TypeEncounter.register.

Doc from com.google.inject.spi.TypeEncounter.register.

Registers a members injector for type I. Guice will use the members injector after its performed its own injections on an instance of I.

Annotations
@Override
registerback to summary
public void register(InjectionListener<? super T> injectionListener)

Implements com.google.inject.spi.TypeEncounter.register.

Doc from com.google.inject.spi.TypeEncounter.register.

Registers an injection listener for type I. Guice will notify the listener after all injections have been performed on an instance of I.

Annotations
@Override