1 package jfun.yan.xml; 2 3 final class Body { 4 private final Object [] keys; 5 private final Closure[] closures; 6 private final Location[] locations; 7 Body(Object [] keys, Closure[] closures, Location[] locations) { 8 this.closures = closures; 9 this.keys = keys; 10 this.locations = locations; 11 } 12 13 Object [] getKeys() { 14 return keys; 15 } 16 Object getKey(int i){ 17 return keys[i]; 18 } 19 Location getLocation(int i){ 20 return locations[i]; 21 } 22 int size(){ 23 return keys.length; 24 } 25 void register(Registry reg){ 26 for(int i=0; i<keys.length; i++){ 27 final Object key = keys[i]; 28 final Closure closure = closures[i]; 30 final Object c = closure.get(); 34 if(key instanceof String ){ 35 reg.put((String )key, c, locations[i]); 37 } 38 } 40 } 41 } 42 | Popular Tags |