Author: pete.muir(a)jboss.org
Date: 2009-08-26 12:35:30 -0400 (Wed, 26 Aug 2009)
New Revision: 3598
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
Log:
Improve generic type info
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-08-26
15:59:26 UTC (rev 3597)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-08-26
16:35:30 UTC (rev 3598)
@@ -25,8 +25,6 @@
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.ObserverMethod;
import javax.enterprise.inject.spi.ProcessObserverMethod;
@@ -160,18 +158,19 @@
}
}
- protected void createObserverMethods(RIBean<?> declaringBean, WBClass<?>
annotatedClass)
+ protected <X> void createObserverMethods(RIBean<X> declaringBean,
WBClass<X> annotatedClass)
{
- for (WBMethod<?, ?> method :
annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ for (WBMethod<?, X> method :
annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
{
createObserverMethod(declaringBean, method);
}
}
- protected void createObserverMethod(RIBean<?> declaringBean, WBMethod<?,
?> method)
+ protected <X, T> void createObserverMethod(RIBean<X> declaringBean,
WBMethod<T, X> method)
{
- ObserverMethodImpl<?, ?> observer = ObserverFactory.create(method,
declaringBean, manager);
- //ProcessObserverMethod<?, ?> event =
createProcessObserverMethodEvent(observer, method);
+ ObserverMethodImpl<X, T> observer = ObserverFactory.create(method,
declaringBean, manager);
+ ProcessObserverMethod<?, ?> event =
createProcessObserverMethodEvent(observer, method);
+ manager.fireEvent(event);
getEnvironment().addObserver(observer);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-08-26
15:59:26 UTC (rev 3597)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-08-26
16:35:30 UTC (rev 3598)
@@ -176,6 +176,14 @@
{
return transactionPhase;
}
+
+ /**
+ * @return the observerMethod
+ */
+ public MethodInjectionPoint<?, ?> getMethod()
+ {
+ return observerMethod;
+ }
/**
* Completes initialization of the observer and allows derived types to
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-08-26
15:59:26 UTC (rev 3597)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-08-26
16:35:30 UTC (rev 3598)
@@ -65,7 +65,7 @@
return delegate().getDeclaredWBAnnotatedMethods(annotationType);
}
- public Set<WBMethod<?, ?>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
+ public Set<WBMethod<?, T>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
{
return delegate().getWBDeclaredMethodsWithAnnotatedParameters(annotationType);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-08-26
15:59:26 UTC (rev 3597)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-08-26
16:35:30 UTC (rev 3598)
@@ -190,7 +190,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?, ?>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType);
+ public Set<WBMethod<?, T>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType);
/**
* Gets the superclass.
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-08-26
15:59:26 UTC (rev 3597)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-08-26
16:35:30 UTC (rev 3598)
@@ -105,7 +105,7 @@
// The map from annotation type to abstracted method with annotation
private final SetMultimap<Class<? extends Annotation>, WBMethod<?,
?>> declaredAnnotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?,
?>> declaredMethodsByAnnotatedParameters;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?,
T>> declaredMethodsByAnnotatedParameters;
// The set of abstracted constructors
private final Set<WBConstructor<T>> constructors;
@@ -351,12 +351,12 @@
}
});
- this.declaredMethodsByAnnotatedParameters = Multimaps.newSetMultimap(new
HashMap<Class<? extends Annotation>, Collection<WBMethod<?,
?>>>(), new Supplier< Set<WBMethod<?, ?>>>()
+ this.declaredMethodsByAnnotatedParameters = Multimaps.newSetMultimap(new
HashMap<Class<? extends Annotation>, Collection<WBMethod<?,
T>>>(), new Supplier< Set<WBMethod<?, T>>>()
{
- public Set<WBMethod<?, ?>> get()
+ public Set<WBMethod<?, T>> get()
{
- return new HashSet<WBMethod<?, ?>>();
+ return new HashSet<WBMethod<?, T>>();
}
});
@@ -381,14 +381,14 @@
method.setAccessible(true);
}
- WBMethod<?, ?> annotatedMethod = null;
+ WBMethod<?, T> annotatedMethod = null;
if (annotatedTypeMethods.containsKey(method))
{
annotatedMethod = WBMethodImpl.of(annotatedTypeMethods.get(method), this,
classTransformer);
}
else
{
- annotatedMethod = WBMethodImpl.of(method, getDeclaringWBClass(method,
classTransformer), classTransformer);
+ annotatedMethod = WBMethodImpl.of(method,
this.<T>getDeclaringWBClass(method, classTransformer), classTransformer);
}
this.methods.add(annotatedMethod);
this.methodsBySignature.put(annotatedMethod.getSignature(),
annotatedMethod);
@@ -594,7 +594,7 @@
return
Collections.unmodifiableSet(constructorsByAnnotatedParameters.get(annotationType));
}
- public Set<WBMethod<?, ?>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
+ public Set<WBMethod<?, T>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
{
return
Collections.unmodifiableSet(declaredMethodsByAnnotatedParameters.get(annotationType));
}