[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...
Gavin King
gavin.king at jboss.com
Fri Oct 27 17:32:34 EDT 2006
User: gavin
Date: 06/10/27 17:32:34
Modified: src/main/org/jboss/seam Component.java
Log:
event parameters
Revision Changes Path
1.197 +11 -6 jboss-seam/src/main/org/jboss/seam/Component.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Component.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -b -r1.196 -r1.197
--- Component.java 25 Oct 2006 15:14:34 -0000 1.196
+++ Component.java 27 Oct 2006 21:32:34 -0000 1.197
@@ -111,7 +111,7 @@
*
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @author Gavin King
- * @version $Revision: 1.196 $
+ * @version $Revision: 1.197 $
*/
@Scope(ScopeType.APPLICATION)
@SuppressWarnings("deprecation")
@@ -439,7 +439,7 @@
Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
for ( String eventType : method.getAnnotation(Observer.class).value() )
{
- if ( eventType.length()==0 ) eventType = method.getName();
+ if ( eventType.length()==0 ) eventType = method.getName(); //TODO: new defaulting rule to map @Observer onFooEvent() -> event type "fooEvent"
init.addObserverMethod(eventType, method, this);
}
}
@@ -1637,7 +1637,7 @@
}
}
- public Object callComponentMethod(Object instance, Method method) {
+ public Object callComponentMethod(Object instance, Method method, Object... parameters) {
Class[] paramTypes = method.getParameterTypes();
String methodName = method.getName();
try
@@ -1645,10 +1645,15 @@
Method interfaceMethod = instance.getClass().getMethod(methodName, paramTypes);
if ( paramTypes.length==0 )
{
- return Reflections.invokeAndWrap( interfaceMethod, instance );
+ return Reflections.invokeAndWrap(interfaceMethod, instance);
}
- else {
- return Reflections.invokeAndWrap( interfaceMethod, instance, this );
+ else if ( parameters.length>0 )
+ {
+ return Reflections.invokeAndWrap(interfaceMethod, instance, parameters);
+ }
+ else
+ {
+ return Reflections.invokeAndWrap(interfaceMethod, instance, this);
}
}
catch (NoSuchMethodException e)
More information about the jboss-cvs-commits
mailing list