1 package jfun.yan.xml.nuts.optional; 2 3 import jfun.yan.Binder; 4 import jfun.yan.Component; 5 import jfun.yan.etc.InjectorHelper; 6 import jfun.yan.xml.nut.ComponentNut; 7 8 19 public class InjectorNut extends ComponentNut { 20 public static final InjectorHelper helper = new InjectorHelper(); 21 private Class itf; 22 private Binder injection; 23 24 public Binder getInjection() { 25 checkMandatory("injection", injection); 26 return injection; 27 } 28 29 public void setInjection(Binder injection) { 30 this.injection = injection; 31 } 32 38 public void add(Binder binder){ 39 checkDuplicate("injection", this.injection); 40 this.injection = binder; 41 } 42 public Class getType() { 43 checkMandatory("type", itf); 44 return itf; 45 } 46 47 public void setType(Class itf) { 48 this.itf = itf; 49 } 50 51 public Component eval(){ 52 return helper.getInjectorComponent(getType(), 53 getInjection()); 54 } 55 56 } 57 | Popular Tags |