Simplifying listeners:
This removes InjectableType, replacing it with TypeLiteral.
InjectableType.Listener and InjectableType.Encounter are now top-level interfaces in the SPI.
Still outstanding: support both afterInjection() and memberInjectors for two-phase post injection listeners.
git-svn-id: https://google-guice.googlecode.com/svn/trunk@926 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/EncounterImpl.java b/src/com/google/inject/EncounterImpl.java
index edcb389..468ee42 100644
--- a/src/com/google/inject/EncounterImpl.java
+++ b/src/com/google/inject/EncounterImpl.java
@@ -22,9 +22,9 @@
import static com.google.inject.internal.Preconditions.checkState;
import com.google.inject.matcher.Matcher;
import com.google.inject.matcher.Matchers;
-import com.google.inject.spi.InjectableType;
import com.google.inject.spi.InjectionListener;
import com.google.inject.spi.Message;
+import com.google.inject.spi.TypeEncounter;
import java.lang.reflect.Method;
import java.util.List;
import org.aopalliance.intercept.MethodInterceptor;
@@ -32,7 +32,7 @@
/**
* @author jessewilson@google.com (Jesse Wilson)
*/
-public final class EncounterImpl<T> implements InjectableType.Encounter<T> {
+final class EncounterImpl<T> implements TypeEncounter<T> {
private final Errors errors;
private final Lookups lookups;
@@ -49,16 +49,10 @@
valid = false;
}
- public boolean hasAddedAspects() {
- return aspects != null;
- }
-
- public boolean hasAddedListeners() {
- return injectionListeners != null;
- }
-
- public List<MethodAspect> getAspects() {
- return aspects;
+ public ImmutableList<MethodAspect> getAspects() {
+ return aspects == null
+ ? ImmutableList.<MethodAspect>of()
+ : ImmutableList.copyOf(aspects);
}
public ImmutableList<InjectionListener<? super T>> getInjectionListeners() {