View Javadoc
1 package jrre.api.java.lang.reflect; 2 3 public class DescriptorDecoder { 4 5 private static int parameterCount = 0; 6 7 public static int getParameterCount(){ 8 int toReturn = parameterCount; 9 parameterCount = 0; 10 return toReturn; 11 } 12 13 public static java.util.Iterator getMethodTypes(String descriptor){ 14 15 java.util.ArrayList typeList = new java.util.ArrayList(); 16 17 int descriptorIndex = 0; 18 char typeChar = descriptor.charAt(++descriptorIndex); 19 //char typeChar = '!'; 20 StringBuffer typeName = new StringBuffer(); 21 22 // Make a place for the methods return type. 23 typeList.add("return type"); 24 25 while(typeChar != ')' && descriptorIndex < descriptor.length()){ 26 27 parameterCount++; 28 29 typeName.delete(0, typeName.length()); 30 31 //typeChar = descriptor.charAt(++descriptorIndex); 32 33 // Array type. 34 while(typeChar == '['){ 35 typeName.append("["); 36 typeChar = descriptor.charAt(++descriptorIndex); 37 } 38 39 // Object type. 40 if(typeChar == 'L'){ 41 typeName.append(typeChar); 42 while(typeChar != ';'){ 43 typeChar = descriptor.charAt(++descriptorIndex); 44 typeName.append(typeChar); 45 } 46 } 47 else{ 48 typeName.append(typeChar); 49 } 50 51 typeList.add(typeName.toString()); 52 //System.out.println("tn: "+typeName.toString()); 53 54 typeChar = descriptor.charAt(++descriptorIndex); 55 } 56 57 // Get return type and put at the beginning of 58 // the list. 59 //typeList.add(0, new String(descriptor.charAt(++descriptorIndex)+"")); 60 61 return typeList.iterator(); 62 } 63 } 64

This page was automatically generated by Maven