1 package gnu.kawa.reflect; 2 import gnu.bytecode.ClassType; 3 import gnu.mapping.*; 4 import gnu.expr.*; 5 6 public class StaticFieldLocation extends FieldLocation 7 { 8 public StaticFieldLocation(String cname, String fname) 9 { 10 super(null, ClassType.make(cname), fname); 11 } 12 13 public StaticFieldLocation(ClassType type, String mname) 14 { 15 super(null, type, mname); 16 } 17 18 public Object get (Object defaultValue) 19 { 20 Object val = super.get(defaultValue); 21 if (val instanceof kawa.lang.Macro) 22 getDeclaration(); 23 return val; 24 } 25 26 public static StaticFieldLocation 27 define(Environment environ, Symbol sym, Object property, 28 String cname, String fname) 29 { 30 StaticFieldLocation loc = new StaticFieldLocation(cname, fname); 31 environ.addLocation(sym, property, loc); 32 return loc; 33 } 34 35 public static StaticFieldLocation make (Declaration decl) 36 { 37 gnu.bytecode.Field fld = decl.field; 38 ClassType ctype = fld.getDeclaringClass(); 39 StaticFieldLocation loc = new StaticFieldLocation(ctype, fld.getName()); 40 loc.setDeclaration(decl); 41 return loc; 43 } 44 45 public static StaticFieldLocation make ( String cname, String fldName) 46 { 47 return new StaticFieldLocation(cname, fldName); 48 } 49 } 50 | Popular Tags |