1 28 package org.jruby.runtime; 29 30 import org.jruby.RubyModule; 31 import org.jruby.internal.runtime.methods.DynamicMethod; 32 import org.jruby.internal.runtime.methods.ReflectionMethodFactory; 33 import org.jruby.internal.runtime.methods.InvocationMethodFactory; 34 import org.jruby.internal.runtime.methods.DumpingInvocationMethodFactory; 35 import org.jruby.util.collections.SinglyLinkedList; 36 37 40 public abstract class MethodFactory { 41 public abstract DynamicMethod getFullMethod(RubyModule implementationClass, Class type, String methodName, Arity arity, Visibility visibility); 42 public abstract DynamicMethod getSimpleMethod(RubyModule implementationClass, Class type, String methodName, Arity arity, Visibility visibility); 43 public abstract DynamicMethod getCompiledMethod(RubyModule implementationClass, Class type, String method, Arity arity, Visibility visibility, SinglyLinkedList cref); 44 45 private static boolean reflection = false; 46 private static boolean dumping = false; 47 private static String dumpingPath = null; 48 49 static { 50 if(System.getProperty("jruby.reflection") != null && Boolean.getBoolean("jruby.reflection")) { 51 reflection = true; 52 } 53 if(System.getProperty("jruby.dump_invocations") != null) { 54 dumping = true; 55 dumpingPath = System.getProperty("jruby.dump_invocations").toString(); 56 } 57 } 58 59 public static MethodFactory createFactory() { 60 if(reflection) { 61 return new ReflectionMethodFactory(); 62 } else if(dumping) { 63 return new DumpingInvocationMethodFactory(dumpingPath); 64 } else { 65 return new InvocationMethodFactory(); 66 } 67 } 68 } | Popular Tags |