fullTypeParameters.addAll(typeParameters);
final List<TypeParameter> params = methodDeclaration
.getTypeParameters();
if (params != null) {
for (final TypeParameter candidate : params) {
final JavaSymbolName currentTypeParam = new JavaSymbolName(
candidate.getName());
fullTypeParameters.add(currentTypeParam);
}
}
// Compute the return type
final Type rt = methodDeclaration.getType();
returnType = JavaParserUtils.getJavaType(compilationUnitServices, rt,
fullTypeParameters);
// Compute the method name
methodName = new JavaSymbolName(methodDeclaration.getName());
// Get the body
body = methodDeclaration.getBody() == null ? null : methodDeclaration
.getBody().toString();
if (body != null) {
body = StringUtils.replace(body, "{", "", 1);
body = body.substring(0, body.lastIndexOf("}"));
}
// Lookup the parameters and their names
if (methodDeclaration.getParameters() != null) {
for (final Parameter p : methodDeclaration.getParameters()) {
final Type pt = p.getType();
final JavaType parameterType = JavaParserUtils.getJavaType(
compilationUnitServices, pt, fullTypeParameters);
final List<AnnotationExpr> annotationsList = p.getAnnotations();
final List<AnnotationMetadata> annotations = new ArrayList<AnnotationMetadata>();
if (annotationsList != null) {
for (final AnnotationExpr candidate : annotationsList) {
final AnnotationMetadata annotationMetadata = JavaParserAnnotationMetadataBuilder
.getInstance(candidate, compilationUnitServices)
.build();
annotations.add(annotationMetadata);
}
}
final AnnotatedJavaType param = new AnnotatedJavaType(
parameterType, annotations);
param.setVarArgs(p.isVarArgs());
parameterTypes.add(param);
parameterNames.add(new JavaSymbolName(p.getId().getName()));
}
}
if (methodDeclaration.getThrows() != null) {
for (final NameExpr throwsType : methodDeclaration.getThrows()) {