Package com.bacoder.parser.java.api

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


  @Override
  public TypeDeclaration adapt(TypeDeclarationContext context) {
    ClassDeclarationContext classDeclarationContext =
        getChild(context, ClassDeclarationContext.class);
    if (classDeclarationContext != null) {
      ClassDeclaration classDeclaration =
          getAdapter(ClassDeclarationAdapter.class).adapt(classDeclarationContext);
      setNodeAttributes(classDeclaration, context);
      setClassOrInterfaceModifiers(context, classDeclaration);
      return classDeclaration;
    }
View Full Code Here


    super(adapters);
  }

  @Override
  public ClassDeclaration adapt(ClassDeclarationContext context) {
    ClassDeclaration classDeclaration = createNode(context);

    Identifier name =
        transformOne(context, TerminalNode.class, new Function<TerminalNode, Identifier>() {
          @Override
          public Identifier apply(TerminalNode node) {
            if (node.getSymbol().getType() == JavaParser.Identifier) {
              return getAdapter(IdentifierAdapter.class).adapt(node);
            } else {
              return null;
            }
          }
        });
    classDeclaration.setName(name);

    TypeParametersContext typeParametersContext = getChild(context, TypeParametersContext.class);
    if (typeParametersContext != null) {
      classDeclaration.setTypeParameters(
          getAdapter(TypeParametersAdapter.class).adapt(typeParametersContext));
    }

    TypeContext typeContext = getChild(context, TypeContext.class);
    if (typeContext != null) {
      classDeclaration.setExtendsType(getAdapter(TypeAdapter.class).adapt(typeContext));
    }

    TypeListContext typeListContext = getChild(context, TypeListContext.class);
    if (typeListContext != null) {
      classDeclaration.setImplementsTypes(getAdapter(TypeListAdapter.class).adapt(typeListContext));
    }

    ClassBodyContext classBodyContext = getChild(context, ClassBodyContext.class);
    if (classBodyContext != null) {
      classDeclaration.setMemberDeclarations(
          getAdapter(ClassBodyAdapter.class).adapt(classBodyContext));
    }

    return classDeclaration;
  }
View Full Code Here

TOP

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

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.