misc cleanup/perf enhancement
[org.ibex.classgen.git] / src / org / ibex / classgen / MethodRef.java
1 package org.ibex.classgen;
2
3 public class MethodRef extends ClassGen.FieldOrMethodRef {
4     public MethodRef(Type.Object c, String name, Type ret, Type[] args) {
5         super(c,name,getDescriptor(ret,args));
6     }
7     public MethodRef(String s, String name, Type ret, Type[] args) {
8         this(new Type.Object(s),name,ret,args);
9     }
10     MethodRef(MethodRef i) { super(i); }
11     
12     static String getDescriptor(Type ret, Type[] args) {
13         StringBuffer sb = new StringBuffer(args.length*4);
14         sb.append("(");
15         for(int i=0;i<args.length;i++) sb.append(args[i].getDescriptor());
16         sb.append(")");
17         sb.append(ret.getDescriptor());
18         return sb.toString();
19     }
20     
21     public static class I extends MethodRef {
22         public I(Type.Object c, String name, Type ret, Type[] args) { super(c,name,ret,args); }
23         public I(String s, String name, Type ret, Type[] args) { super(s,name,ret,args); }
24         I(MethodRef m) { super(m); }
25     }
26 }