Package com.google.inject.spi
Class InjectionPoint.OverrideIndex
- java.lang.Object
-
- com.google.inject.spi.InjectionPoint.OverrideIndex
-
- Enclosing class:
- InjectionPoint
static class InjectionPoint.OverrideIndex extends java.lang.Object
Keeps track of injectable methods so we can remove methods that get overridden in O(1) time. Uses our position in the type hierarchy to perform optimizations.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<InjectionPoint.Signature,java.util.List<InjectionPoint.InjectableMethod>>
bySignature
(package private) InjectionPoint.InjectableMembers
injectableMembers
(package private) java.lang.reflect.Method
lastMethod
(package private) InjectionPoint.Signature
lastSignature
(package private) InjectionPoint.Position
position
-
Constructor Summary
Constructors Constructor Description OverrideIndex(InjectionPoint.InjectableMembers injectableMembers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
add(InjectionPoint.InjectableMethod injectableMethod)
Adds the given method to the list of injection points.(package private) boolean
removeIfOverriddenBy(java.lang.reflect.Method method, boolean alwaysRemove, InjectionPoint.InjectableMethod injectableMethod)
Removes a method overridden by the given method, if present.
-
-
-
Field Detail
-
injectableMembers
final InjectionPoint.InjectableMembers injectableMembers
-
bySignature
java.util.Map<InjectionPoint.Signature,java.util.List<InjectionPoint.InjectableMethod>> bySignature
-
position
InjectionPoint.Position position
-
lastMethod
java.lang.reflect.Method lastMethod
-
lastSignature
InjectionPoint.Signature lastSignature
-
-
Constructor Detail
-
OverrideIndex
OverrideIndex(InjectionPoint.InjectableMembers injectableMembers)
-
-
Method Detail
-
removeIfOverriddenBy
boolean removeIfOverriddenBy(java.lang.reflect.Method method, boolean alwaysRemove, InjectionPoint.InjectableMethod injectableMethod)
Removes a method overridden by the given method, if present. In order to remain backwards compatible with prior Guice versions, this will *not* remove overridden methods if 'alwaysRemove' is false and the overridden signature was annotated with a com.google.inject.Inject.- Parameters:
method
- The method used to determine what is overridden and should be removed.alwaysRemove
- true if overridden methods should be removed even if they were guice @InjectinjectableMethod
- if this method overrode any guice @Inject methods,InjectionPoint.InjectableMethod.overrodeGuiceInject
is set to true
-
add
void add(InjectionPoint.InjectableMethod injectableMethod)
Adds the given method to the list of injection points. Keeps track of it in this index in case it gets overridden.
-
-