1 package jfun.yan.xml.nuts; 2 3 4 import jfun.yan.Component; 5 import jfun.yan.xml.nut.ComponentNut; 6 7 15 public abstract class CollectionNut extends ComponentNut { 16 private Class elem_type; 17 private Class type; 18 private Component[] elements; 19 public void setType(Class type){ 20 this.type = type; 21 } 22 public Class getType(){ 23 return type; 24 } 25 30 public Class getType(Class deftype){ 31 return type==null?deftype:type; 32 } 33 public void setOf(Class etype){ 34 this.elem_type = etype; 35 } 36 public Class getOf(){ 37 return elem_type; 38 } 39 public void setElements(Component[] ccs){ 40 this.elements = ccs; 41 } 42 public void set(Component[] ccs){ 43 checkDuplicate("elements", elements); 44 this.elements = ccs; 45 } 46 49 public Component[] getMandatoryElements(){ 50 checkMandatory("elements", elements); 51 if(elem_type==null) 52 return elements; 53 else 54 return Util.convert(this, elem_type, elements); 55 } 56 public Component[] getElements(){ 57 return elements; 58 } 59 } 60 | Popular Tags |