1 19 24 25 package org.netbeans.modules.javacore.parser; 26 27 import java.util.ArrayList ; 28 import java.util.List ; 29 import org.netbeans.jmi.javamodel.CallableFeature; 30 import org.netbeans.jmi.javamodel.Feature; 31 import org.netbeans.modules.javacore.jmiimpl.javamodel.ParameterImpl; 32 33 37 class InfoUtil { 38 39 40 private InfoUtil() { 41 } 42 43 static TypeRef[] getTypeNames(CallableFeature call) { 44 Object [] pars=call.getParameters().toArray(); 45 List types=new ArrayList (pars.length); 46 47 for (int i=0;i<pars.length;i++) { 48 ParameterImpl par=(ParameterImpl)pars[i]; 49 50 types.add(par.getTypeRef()); 51 } 52 return (TypeRef[])types.toArray(new TypeRef[pars.length]); 53 } 54 55 static TypeRef[] getTypeNames(ParameterInfo[] parameters) { 56 TypeRef[] typeNames = new TypeRef[parameters.length]; 57 58 for (int i = 0; i < parameters.length; i++) { 59 typeNames[i] = parameters[i].type; 60 } 61 return typeNames; 62 } 63 64 static String [] getElementNames(ElementInfo[] features) { 65 String memberNames[] = new String [features.length]; 66 67 for (int i = 0; i < features.length; i++) { 68 memberNames[i] = features[i].name; 69 } 70 return memberNames; 71 } 72 73 static String [] getElementNames(List featuresList) { 74 Object [] features=featuresList.toArray(); 75 List names=new ArrayList (); 76 77 for(int i=0;i<features.length;i++) { 78 Feature f=(Feature)features[i]; 79 80 names.add(f.getName()); 81 } 82 return (String [])names.toArray(new String [names.size()]); 83 } 84 } 85 | Popular Tags |