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

EntityManagerFactoryMethodInjector

public class EntityManagerFactoryMethodInjector extends Object implements Injector, PojoInjector
Comment
author
Bill Burke
version
$Revision: 60233 $

Fields Summary
private static final Logger
log
private Method
setMethod
private Object
factory
Constructors Summary
public EntityManagerFactoryMethodInjector(Method setMethod, Object factory)


       
   
      this.setMethod = setMethod;
      setMethod.setAccessible(true);
      this.factory = factory;
   
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)

      inject(instance);
   
public voidinject(java.lang.Object instance)

      try
      {
         Object[] args = {factory};
         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.
      }