1 package jfun.yan.xml.nuts.optional; 2 3 import jfun.yan.Binder; 4 import jfun.yan.Component; 5 import jfun.yan.xml.nuts.DelegatingNut; 6 21 public class InjectNut extends DelegatingNut { 22 private Class itf; 23 private Class injectee; 24 private Binder injection; 25 26 public Class getInjectee() { 27 checkMandatory("injectee", injectee); 28 return injectee; 29 } 30 31 public void setInjectee(Class injectee) { 32 this.injectee = injectee; 33 } 34 35 public Binder getInjection() { 36 checkMandatory("injection", injection); 37 return injection; 38 } 39 40 public void setInjection(Binder injection) { 41 this.injection = injection; 42 } 43 44 public Class getType() { 45 checkMandatory("type", itf); 46 return itf; 47 } 48 49 public void setType(Class itf) { 50 this.itf = itf; 51 } 52 53 public Component eval(){ 54 final Component proxied = getMandatory(); 55 return InjectorNut.helper 56 .getProxyComponentReturningInjected(getComponentClassLoader(), 57 itf, proxied, injectee, injection); 58 } 59 } 60 | Popular Tags |