1 29 30 package com.caucho.quercus.env; 31 32 import com.caucho.quercus.QuercusException; 33 import com.caucho.quercus.module.ModuleContext; 34 import com.caucho.util.L10N; 35 36 import java.lang.reflect.Constructor ; 37 38 41 public class JavaConstructor extends JavaInvoker { 42 private static final L10N L = new L10N(JavaConstructor.class); 43 44 private final Constructor _constructor; 45 46 51 public JavaConstructor(ModuleContext moduleContext, 52 Constructor cons) 53 { 54 super(moduleContext, 55 cons.getDeclaringClass().getName(), 56 cons.getParameterTypes(), 57 cons.getParameterAnnotations(), 58 cons.getAnnotations(), 59 cons.getDeclaringClass()); 60 61 _constructor = cons; 62 } 63 64 public Object invoke(Object obj, Object []args) 65 { 66 try { 67 obj = _constructor.newInstance(args); 68 69 return obj; 70 } catch (Exception e) { 71 throw new QuercusException(e); 72 } 73 } 74 } 75 | Popular Tags |