Package com.bacoder.parser.java.api

Examples of com.bacoder.parser.java.api.ClassMethodDeclaration


  @Override
  public ClassMethodDeclaration adapt(GenericMethodDeclarationContext context) {
    MethodDeclarationContext methodDeclarationContext =
        getChild(context, MethodDeclarationContext.class);
    if (methodDeclarationContext != null) {
      ClassMethodDeclaration methodDeclaration =
          getAdapter(MethodDeclarationAdapter.class).adapt(methodDeclarationContext);
      TypeParametersContext typeParametersContext = getChild(context, TypeParametersContext.class);
      if (typeParametersContext != null) {
        methodDeclaration.setTypeParameters(
            getAdapter(TypeParametersAdapter.class).adapt(typeParametersContext));
      }
      return methodDeclaration;
    }
View Full Code Here


    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;
  }
View Full Code Here

TOP

Related Classes of com.bacoder.parser.java.api.ClassMethodDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.