Package com.bacoder.parser.java.api

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


    super(adapters);
  }

  @Override
  public EnumDeclaration adapt(EnumDeclarationContext context) {
    EnumDeclaration enumDeclaration = createNode(context);

    TerminalNode identifierNode = getTerminalNode(context, JavaParser.Identifier);
    if (identifierNode != null) {
      enumDeclaration.setName(getAdapter(IdentifierAdapter.class).adapt(identifierNode));
    }

    TypeListContext typeListContext = getChild(context, TypeListContext.class);
    if (typeListContext != null) {
      List<Type> implementsTypes =
          transform(typeListContext, TypeContext.class, new Function<TypeContext, Type>() {
            @Override
            public Type apply(TypeContext context) {
              return getAdapter(TypeAdapter.class).adapt(context);
            }
          });
      enumDeclaration.setImplementsTypes(implementsTypes);
    }

    EnumConstantsContext enumConstantsContext = getChild(context, EnumConstantsContext.class);
    if (enumConstantsContext != null) {
      List<EnumConstant> constants =
          transform(enumConstantsContext, EnumConstantContext.class,
              new Function<EnumConstantContext, EnumConstant>() {
                @Override
                public EnumConstant apply(EnumConstantContext context) {
                  return getAdapter(EnumConstantAdapter.class).adapt(context);
                }
              });
      enumDeclaration.setConstants(constants);
    }

    EnumBodyDeclarationsContext enumBodyDeclarationsContext =
        getChild(context, EnumBodyDeclarationsContext.class);
    if (enumBodyDeclarationsContext != null) {
      List<ClassMemberDeclaration> memberDeclarations =
          transform(enumBodyDeclarationsContext, ClassBodyDeclarationContext.class,
              new Function<ClassBodyDeclarationContext, ClassMemberDeclaration>() {
                @Override
                public ClassMemberDeclaration apply(ClassBodyDeclarationContext context) {
                  return getAdapter(ClassBodyDeclarationAdapter.class).adapt(context);
                }
              });
      enumDeclaration.setMemberDeclarations(memberDeclarations);
    }

    return enumDeclaration;
  }
View Full Code Here


      return classDeclaration;
    }

    EnumDeclarationContext enumDeclarationContext = getChild(context, EnumDeclarationContext.class);
    if (enumDeclarationContext != null) {
      EnumDeclaration enumDeclaration =
          getAdapter(EnumDeclarationAdapter.class).adapt(enumDeclarationContext);
      setClassOrInterfaceModifiers(context, enumDeclaration);
      return enumDeclaration;
    }
View Full Code Here

TOP

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

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.