1 29 30 package com.caucho.quercus.program; 31 32 import com.caucho.quercus.QuercusRuntimeException; 33 import com.caucho.quercus.env.ArrayValue; 34 import com.caucho.quercus.env.ArrayValueImpl; 35 import com.caucho.quercus.env.Env; 36 import com.caucho.quercus.env.QuercusClass; 37 import com.caucho.quercus.env.Value; 38 import com.caucho.quercus.expr.Expr; 39 import com.caucho.util.IdentityIntMap; 40 41 import java.lang.reflect.Method ; 42 import java.util.ArrayList ; 43 44 47 public class CompiledClassDef extends ClassDef { 48 private final Class _compiledClass; 49 private final Method _init; 50 51 private final ArrayList <String > _fieldNames 52 = new ArrayList <String >(); 53 54 private final IdentityIntMap _fieldMap 55 = new IdentityIntMap(); 56 57 protected ArrayValue _extFields = new ArrayValueImpl(); 58 protected Value _parent; 59 60 public CompiledClassDef(String name, String parent, String []ifaceList, 61 Class compiledClass) 62 { 63 super(name, parent, ifaceList); 64 65 _compiledClass = compiledClass; 66 try { 67 _init = compiledClass.getMethod("init", 68 new Class [] { QuercusClass.class }); 69 } catch (Exception e) { 70 throw new QuercusRuntimeException(e); 71 } 72 } 73 74 77 public void initClass(QuercusClass cl) 78 { 79 try { 80 _init.invoke(null, cl); 81 } catch (Exception e) { 82 throw new QuercusRuntimeException(e); 83 } 84 } 85 86 89 public int findFieldIndex(String name) 90 { 91 return _fieldMap.get(name); 92 } 93 94 97 public ArrayList <String > getFieldNames() 98 { 99 return _fieldNames; 100 } 101 102 105 protected void addFieldIndex(String name, int id) 106 { 107 _fieldMap.put(name, id); 108 _fieldNames.add(name); 109 } 110 111 114 public AbstractFunction findConstructor() 115 { 116 return null; 117 } 118 119 122 public void initInstance(Env env, Value value) 123 { 124 } 125 126 129 public Value get(Value name) 130 { 131 throw new UnsupportedOperationException (); 132 140 } 141 142 145 public Value getRef(Value name) 146 { 147 throw new UnsupportedOperationException (); 148 156 } 157 158 161 public Value getArgRef(Value name) 162 { 163 throw new UnsupportedOperationException (); 164 170 } 171 172 175 public Value getArray(Value name) 176 { 177 throw new UnsupportedOperationException (); 178 179 190 } 191 192 195 public Value getObject(Env env, Value name) 196 { 197 throw new UnsupportedOperationException (); 198 209 } 210 211 214 public Value getArg(Value name) 215 { 216 throw new UnsupportedOperationException (); 217 218 231 } 232 233 236 public Value put(Value name, Value value) 237 { 238 throw new UnsupportedOperationException (); 239 240 248 } 249 250 253 public Value put(Value value) 254 { 255 throw new UnsupportedOperationException (); 256 257 265 } 266 267 270 public Value putRef() 271 { 272 throw new UnsupportedOperationException (); 273 274 282 } 283 284 287 public Value remove(Value name) 288 { 289 throw new UnsupportedOperationException (); 290 300 } 301 302 305 public Value newInstance() 306 { 307 314 throw new UnsupportedOperationException (); 315 } 316 317 320 public Value callNew(Env env, Expr []args) 321 { 322 return null; 323 } 324 325 328 public Value callNew(Env env, Value []args) 329 { 330 return null; 331 } 332 } 333 334 | Popular Tags |