1 package jfun.yan.xml.nuts; 2 3 import jfun.yan.Component; 4 import jfun.yan.xml.NutsUtils; 5 import jfun.yan.xml.nut.ComponentNut; 6 7 16 public abstract class DelegatingNut extends ComponentNut { 17 private Component cc; 18 19 public Component getComponent() { 20 return cc; 21 } 22 26 protected Component getMandatory(){ 27 checkMandatory("component", cc); 28 return cc; 29 } 30 public void setComponent(Component cc) { 31 if(cc==null) 32 raise("cannot set component to null"); 33 delegateTo(cc); 34 } 35 41 public void add(Object sub){ 42 checkDuplicate("component", this.cc); 43 delegateTo(NutsUtils.asComponent(sub)); 44 } 45 49 protected void delegateTo(Component cc){ 50 this.cc = cc; 51 } 52 } 53 | Popular Tags |