MCPcopy Create free account
hub / github.com/GateNLP/gate-core / getMethodsAndFields

Method getMethodsAndFields

src/main/java/gate/creole/BootStrap.java:256–350  ·  view source on GitHub ↗

create the form for the methods from the class that create the resource @param methodsExtendList is the list with all methods from the class that extends the resource @param methodsInterfacesList is the list with all methods from the interfaces that implement the resource

(List<FeatureMethod> methodsExtendList,
                                                  List<FeatureMethod> methodsInterfacesList)

Source from the content-addressed store, hash-verified

254 * that implement the resource
255 */
256 public void getMethodsAndFields(List<FeatureMethod> methodsExtendList,
257 List<FeatureMethod> methodsInterfacesList){
258 // determine all the methods from the interfaces which are not among the
259 // methods of the class that extends the resource
260
261 int j = 0;
262 for (int i=0;i<methodsInterfacesList.size();i++) {
263 FeatureMethod featureMethod = methodsInterfacesList.get(i);
264 if (methodsExtendList.contains(featureMethod) == false) {
265 // the name of the method
266 String nameMethod = (featureMethod.getNameMethod());
267
268 // the types of the parameters of the method
269 List<String> valTypes = (featureMethod.getParameterTypes());
270
271 // the value which the method returns
272 String typeReturn = determineTypePackage(
273 (featureMethod.getValueReturn()));
274
275 // get the list of exceptions for the current method
276 List<String> valException = (featureMethod.getExceptionTypes());
277
278 String declaration = "public "+ typeReturn +" "+
279 nameMethod +"(";
280 // parameters
281 if (valTypes.size() == 0)
282 declaration = declaration+")";
283 else
284 for (int k=0;k<valTypes.size();k++) {
285 String type = valTypes.get(k);
286 if (type.endsWith("[]"))
287 declaration = declaration +
288 determineTypePackage(type.substring(0,type.length()-2)) +
289 " parameter"+ k;
290 else
291 declaration = declaration +
292 determineTypePackage(valTypes.get(k)) +
293 " parameter"+ k;
294
295 if (k==valTypes.size()-1)
296 declaration = declaration + ")";
297 else
298 declaration = declaration + ", ";
299
300 } // for
301
302 // exceptions
303 if (valException.size() == 0) {
304 if (!typeReturn.equals("void")){
305 if (!typeReturn.endsWith("[]"))
306 declaration = declaration + "{ " + "return "+
307 typeReturn.toLowerCase()+ j + "; }";
308 else
309 declaration = declaration + "{ " + "return "+
310 typeReturn.toLowerCase().substring(
311 0,typeReturn.length()-2)+ j + "; }";
312
313 fields.put(new Integer(j),typeReturn);

Callers 1

getInterfacesAndClassMethod · 0.95

Calls 12

getNameMethodMethod · 0.95
getParameterTypesMethod · 0.95
determineTypePackageMethod · 0.95
getValueReturnMethod · 0.95
getExceptionTypesMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
equalsMethod · 0.65
addMethod · 0.65
containsMethod · 0.45
lengthMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected