go through all methods and determines return type, parameters, exceptions
(Class<?> currentClass, List<FeatureMethod> methodsList)
| 214 | |
| 215 | /**go through all methods and determines return type, parameters, exceptions*/ |
| 216 | public List<FeatureMethod> featuresClass (Class<?> currentClass, List<FeatureMethod> methodsList){ |
| 217 | |
| 218 | // go through all the methods |
| 219 | Method[] listMethodsCurrentClass = currentClass.getMethods(); |
| 220 | for (int i=0;i<listMethodsCurrentClass.length;i++) { |
| 221 | FeatureMethod featureMethod = new FeatureMethod(); |
| 222 | featureMethod.setNameMethod(listMethodsCurrentClass[i].getName()); |
| 223 | featureMethod.setValueReturn( |
| 224 | listMethodsCurrentClass[i].getReturnType().getName()); |
| 225 | |
| 226 | Class<?>[] parameters = ( |
| 227 | listMethodsCurrentClass[i].getParameterTypes()); |
| 228 | Class<?>[] exceptions = ( |
| 229 | listMethodsCurrentClass[i].getExceptionTypes()); |
| 230 | |
| 231 | // determine the parameters for the current method |
| 232 | List<String> aux = new ArrayList<String>(); |
| 233 | for (int k=0;k<parameters.length;k++) |
| 234 | aux.add(parameters[k].getName()); |
| 235 | featureMethod.setParameterTypes(aux); |
| 236 | |
| 237 | // determine the exceptions for the current method |
| 238 | aux = new ArrayList<String>(); |
| 239 | for (int k=0;k<exceptions.length;k++) |
| 240 | aux.add(exceptions[k].getName()); |
| 241 | featureMethod.setExceptionTypes(aux); |
| 242 | |
| 243 | if (!methodsList.contains(featureMethod)){ |
| 244 | methodsList.add(featureMethod); |
| 245 | } |
| 246 | }// for |
| 247 | return methodsList; |
| 248 | }// List featureClass (Class currentClass) |
| 249 | |
| 250 | /** create the form for the methods from the class that create the resource |
| 251 | * @param methodsExtendList is the list with all methods from the class that extends |
no test coverage detected