Package lombok.ast

Examples of lombok.ast.EnumTypeBody


    }
    return posify(result);
  }
 
  public Node createEnumBody(Node head, List<Node> tail, Node typeBody) {
    EnumTypeBody body = new EnumTypeBody();
    if (head != null) body.rawConstants().addToEnd(head);
    if (tail != null) for (Node n : tail) body.rawConstants().addToEnd(n);
    if (typeBody instanceof TypeBody) {
      body.rawMembers().migrateAllFrom(((TypeBody)typeBody).rawMembers());
    }
    return posify(body);
  }
View Full Code Here


        fillList(node.defs, body.rawMembers(), flagKeyMap);
        itfDecl.astBody(body);
      } else if ((flags & Flags.ENUM) != 0) {
        EnumDeclaration enumDecl = new EnumDeclaration();
        typeDecl = enumDecl;
        EnumTypeBody body = new EnumTypeBody();
        fillList(node.implementing, enumDecl.rawImplementing(), FlagKey.TYPE_REFERENCE);
        java.util.List<JCTree> defs = new ArrayList<JCTree>();
       
        for (JCTree def : node.defs) {
          if (def instanceof JCVariableDecl) {
            JCVariableDecl vd = (JCVariableDecl) def;
            if (vd.mods != null && (vd.mods.flags & ENUM_CONSTANT_FLAGS) == ENUM_CONSTANT_FLAGS) {
              // This is an enum constant, not a field of the enum class.
              EnumConstant ec = new EnumConstant();
              setPos(def, ec);
              ec.astName(new Identifier().astValue(vd.getName().toString()));
              fillList(vd.mods.annotations, ec.rawAnnotations());
              if (vd.init instanceof JCNewClass) {
                JCNewClass init = (JCNewClass) vd.init;
                fillList(init.getArguments(), ec.rawArguments());
                if (init.getClassBody() != null) {
                  NormalTypeBody constantBody = setPos(init, new NormalTypeBody());
                  fillList(init.getClassBody().getMembers(), constantBody.rawMembers());
                  ec.astBody(constantBody);
                }
                setConversionPositionInfo(ec, "newClass", getPosition(init));
              }
              body.astConstants().addToEnd(ec);
              continue;
            }
          }
         
          defs.add(def);
        }
        fillList(defs, body.rawMembers(), flagKeyMap);
        enumDecl.astBody(body);
      } else {
        throw new IllegalStateException("Unknown type declaration: " + node);
      }
     
View Full Code Here

TOP

Related Classes of lombok.ast.EnumTypeBody

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.