super(adapters);
}
@Override
public ClassMethodDeclaration adapt(MethodDeclarationContext context) {
ClassMethodDeclaration methodDeclaration = createNode(context);
TypeContext typeContext = getChild(context, TypeContext.class);
if (typeContext != null) {
methodDeclaration.setReturnType(getAdapter(TypeAdapter.class).adapt(typeContext));
} else {
TerminalNode voidNode = getTerminalNode(context, JavaParser.VOID);
if (voidNode != null) {
methodDeclaration.setReturnType(createNode(voidNode, VoidType.class));
}
}
TerminalNode identifierNode = getTerminalNode(context, JavaParser.Identifier);
if (identifierNode != null) {
methodDeclaration.setName(getAdapter(IdentifierAdapter.class).adapt(identifierNode));
}
FormalParametersContext formalParametersContext =
getChild(context, FormalParametersContext.class);
if (formalParametersContext != null) {
methodDeclaration.setFormalParameters(
getAdapter(FormalParametersAdapter.class).adapt(formalParametersContext));
}
methodDeclaration.setDimensions(getAdapter(ArrayDimensionsAdapter.class).adapt(context));
QualifiedNameListContext qualifiedNameListContext =
getChild(context, QualifiedNameListContext.class);
if (qualifiedNameListContext != null) {
methodDeclaration.setThrowsExceptions(
getAdapter(QualifiedNamesAdapter.class).adapt(qualifiedNameListContext));
}
MethodBodyContext methodBodyContext = getChild(context, MethodBodyContext.class);
if (methodBodyContext != null) {
BlockContext blockContext = getChild(methodBodyContext, BlockContext.class);
if (blockContext != null) {
methodDeclaration.setBody(getAdapter(BlockAdapter.class).adapt(blockContext));
}
}
return methodDeclaration;
}