1 7 package org.jboss.ejb3.injection; 8 9 import org.jboss.ejb3.BeanContext; 10 import org.jboss.ejb3.Container; 11 12 import java.lang.reflect.Field ; 13 14 21 public class TimerServiceFieldInjector implements Injector 22 { 23 private Field field; 24 private Container container; 25 26 public TimerServiceFieldInjector(Field field, Container container) 27 { 28 this.field = field; 29 this.field.setAccessible(true); 30 this.container = container; 31 } 32 33 public void inject(BeanContext ctx) 34 { 35 try 36 { 37 field.set(ctx.getInstance(), container.getTimerService()); 38 } 39 catch (IllegalAccessException e) 40 { 41 throw new RuntimeException (e); } 43 catch (IllegalArgumentException e) 44 { 45 throw new RuntimeException ("Failed in setting EntityManager on setter field: " + field.toString()); 46 } 47 } 48 } 49 | Popular Tags |