KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > callback > ListenerCallback


1 /*
2  * JBoss, the OpenSource EJB server
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.ejb3.callback;
8
9 import java.lang.reflect.Method JavaDoc;
10
11 /**
12  * @author <a HREF="mailto:kabir.khan@jboss.org">Kabir Khan</a>
13  * @version $Revision: 1.1.6.1 $
14  */

15 public class ListenerCallback extends Callback
16 {
17    protected Object JavaDoc listener;
18
19    public ListenerCallback(Method JavaDoc callbackMethod, Object JavaDoc listener)
20    {
21       super(callbackMethod);
22       this.listener = listener;
23    }
24
25    public void invoke(Object JavaDoc bean)
26    {
27       try
28       {
29          callbackMethod.invoke(listener, new Object JavaDoc[]{bean});
30       }
31       catch(Exception JavaDoc e)
32       {
33          throw new RuntimeException JavaDoc(e);
34       }
35    }
36
37 }
38
Popular Tags