private IMethodModel processMethod(CtMethod<?> m, TypeModel ownerType) { MethodModel methodModel = new MethodModel(); fillBasic(methodModel, m); fillTypeParameters(methodModel, m); CtTypeReference<?> returnedType = m.getType(); ITypeModel returnedTypeModel = processTypeReference(returnedType); methodModel.setReturnedType(returnedTypeModel); fillJAXBType(methodModel, returnedType); List<CtParameter<?>> parameters = m.getParameters(); for (CtParameter<?> p : parameters) { IParameterModel parameterModel = processParameter(p); methodModel.addParameter(parameterModel); } String returnedTypeSimpleName = returnedType.getSimpleName(); String returnedTypeQualifiedname = returnedType.getQualifiedName(); if (returnedTypeSimpleName.equalsIgnoreCase(returnedTypeQualifiedname)) { for (ITypeParameter tp : ownerType.getTypeParameters()) { if (returnedType.getSimpleName().equals(tp.getName())) { methodModel.setHasGenericReturnType(true); } } for (ITypeParameter tp : methodModel.getTypeParameters()) { if (returnedType.getSimpleName().equals(tp.getName())) { methodModel.setHasGenericReturnType(true); } } } return methodModel; }
private IMethodModel processMethodReference(CtExecutableReference<?> methodElement) { MethodModel methodModel = new MethodModel(); fillReference(methodModel, methodElement); List<CtTypeReference<?>> parameters = methodElement.getParameters(); Method actualMethod = methodElement.getActualMethod(); if (actualMethod != null) { String canonicalName = actualMethod.getReturnType().getCanonicalName(); ITypeModel existingType = registry.getType(canonicalName); if (existingType != null) { methodModel.setReturnedType(existingType); } if (existingType != null) { methodModel.setReturnedType(new ProxyType(registry, canonicalName)); } adjustModifiers(methodModel, actualMethod); } for (CtTypeReference<?> p : parameters) { IParameterModel parameterModel = processParameterReference(p); methodModel.addParameter(parameterModel); } return methodModel; }