KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > xml > Body


1 package jfun.yan.xml;
2
3 final class Body {
4   private final Object JavaDoc[] keys;
5   private final Closure[] closures;
6   private final Location[] locations;
7   Body(Object JavaDoc[] keys, Closure[] closures, Location[] locations) {
8     this.closures = closures;
9     this.keys = keys;
10     this.locations = locations;
11   }
12   
13   Object JavaDoc[] getKeys() {
14     return keys;
15   }
16   Object JavaDoc 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 JavaDoc key = keys[i];
28       //final Location iloc = stmts[i].getLocation();
29
final Closure closure = closures[i];
30       //have to run closure rather than stmt because we don't
31
//want to create multiple instances of Component who may
32
//be singleton.
33
final Object JavaDoc c = closure.get();
34       if(key instanceof String JavaDoc){
35         //skip anonymous ones.
36
reg.put((String JavaDoc)key, c, locations[i]);
37       }
38       //reg.registerComponent(key, asComponent(c));
39
}
40   }
41 }
42
Popular Tags