FileDocCategorySizeDatePackage
EJBContextMethodInjector.javaAPI DocJBoss 4.2.12564Fri Jul 13 20:53:46 BST 2007org.jboss.injection

EJBContextMethodInjector

public class EJBContextMethodInjector extends Object implements Injector, PojoInjector
Comment
author
Bill Burke
version
$Revision: 60233 $
deprecated
use EJBContextPropertyInjector

Fields Summary
private Method
setMethod
Constructors Summary
public EJBContextMethodInjector(Method setMethod)

      this.setMethod = setMethod;
      setMethod.setAccessible(true);
   
Methods Summary
public java.lang.ClassgetInjectionClass()

      return setMethod.getParameterTypes()[0];
   
public voidinject(org.jboss.ejb3.BeanContext ctx)

      inject(ctx, ctx.getInstance());
   
public voidinject(org.jboss.ejb3.BeanContext ctx, java.lang.Object instance)


      Object[] args = {ctx.getEJBContext()};
      try
      {
         setMethod.invoke(instance, args);
      }
      catch (IllegalAccessException e)
      {
         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
      }
      catch (IllegalArgumentException e)
      {
         throw new RuntimeException("Failed in setting EntityManager on setter method: " + setMethod.toString());
      }
      catch (InvocationTargetException e)
      {
         throw new RuntimeException(e.getCause());  //To change body of catch statement use Options | File Templates.
      }
   
public voidinject(java.lang.Object instance)

      throw new RuntimeException("Illegal operation");