Examples of EnumConstantDeclaration


Examples of japa.parser.ast.body.EnumConstantDeclaration

    List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
    List<Expression> args = visit(_n.getArgs(), _arg);
    List<BodyDeclaration> classBody = visit(_n.getClassBody(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    EnumConstantDeclaration r = new EnumConstantDeclaration(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
         annotations, _n.getName(), args, classBody
    );
    r.setComment(comment);
    return r;
  }
View Full Code Here

Examples of japa.parser.ast.body.EnumConstantDeclaration

    printer.printLn(" {");
    printer.indent();
    if (n.getEntries() != null) {
      printer.printLn();
      for (final Iterator<EnumConstantDeclaration> i = n.getEntries().iterator(); i.hasNext();) {
        final EnumConstantDeclaration e = i.next();
        e.accept(this, arg);
        if (i.hasNext()) {
          printer.print(", ");
        }
      }
    }
View Full Code Here

Examples of japa.parser.ast.body.EnumConstantDeclaration

  @Override public Boolean visit(final EmptyTypeDeclaration n1, final Node arg) {
    return Boolean.TRUE;
  }

  @Override public Boolean visit(final EnumConstantDeclaration n1, final Node arg) {
    final EnumConstantDeclaration n2 = (EnumConstantDeclaration) arg;

    // javadoc are checked at CompilationUnit

    if (!objEquals(n1.getName(), n2.getName())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getClassBody(), n2.getClassBody())) {
      return Boolean.FALSE;
    }

    return Boolean.TRUE;
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.dom.EnumConstantDeclaration

          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          enumDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        List enumConstants = enumDeclaration.enumConstants();
        for (Iterator iter = enumConstants.iterator(); iter.hasNext();) {
          EnumConstantDeclaration enumConstantDeclaration = (EnumConstantDeclaration) iter.next();
          enumConstantDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(enumConstantDeclaration.getStartPosition()));
          enumDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(enumConstantDeclaration)));
        }       
        return true;
      }
    });
View Full Code Here

Examples of org.eclipse.jdt.core.dom.EnumConstantDeclaration

     * @param value
     * @param doc documentation text, or <code>null</code> if none
     */
    public void addEnumConstant(String value, String doc) {
        if (m_class instanceof EnumDeclaration) {
            EnumConstantDeclaration enumdecl = getAST().newEnumConstantDeclaration();
            enumdecl.setName(getAST().newSimpleName(value));
            addJavaDoc(doc, enumdecl);
            ((EnumDeclaration)m_class).enumConstants().add(enumdecl);
        } else {
            // should not be possible, but just in case of added types in future
            throw new IllegalStateException("Internal error - cannot add constant to class type");
View Full Code Here

Examples of org.eclipse.jdt.core.dom.EnumConstantDeclaration

     * @param doc documentation text, or <code>null</code> if none
     * @param value
     */
    public void addEnumConstant(String name, String doc, String value) {
        if (m_class instanceof EnumDeclaration) {
            EnumConstantDeclaration enumdecl = getAST().newEnumConstantDeclaration();
            enumdecl.setName(getAST().newSimpleName(name));
            StringLiteral strlit = getAST().newStringLiteral();
            strlit.setLiteralValue(value);
            enumdecl.arguments().add(strlit);
            addJavaDoc(doc, enumdecl);
            ((EnumDeclaration)m_class).enumConstants().add(enumdecl);
        } else {
            // should not be possible, but just in case of added types in future
            throw new IllegalStateException("Internal error - cannot add constant to class type");
View Full Code Here

Examples of org.eclipse.jdt.core.dom.EnumConstantDeclaration

      }
    }
 
    IValueList enumConstants = new IValueList(values);
    for (Iterator it = node.enumConstants().iterator(); it.hasNext();) {
      EnumConstantDeclaration d = (EnumConstantDeclaration) it.next();
      enumConstants.add(visitChild(d));
    }
 
    IValueList bodyDeclarations = new IValueList(values);
    if (!node.bodyDeclarations().isEmpty()) {
View Full Code Here

Examples of org.eclipse.jdt.core.dom.EnumConstantDeclaration

      }
      this.buffer.append(" ");//$NON-NLS-1$
    }
    this.buffer.append("{");//$NON-NLS-1$
    for (Iterator it = node.enumConstants().iterator(); it.hasNext(); ) {
      EnumConstantDeclaration d = (EnumConstantDeclaration) it.next();
      d.accept(this);
      // enum constant declarations do not include punctuation
      if (it.hasNext()) {
        // enum constant declarations are separated by commas
        this.buffer.append(", ");//$NON-NLS-1$
      }
    }
    if (!node.bodyDeclarations().isEmpty()) {
      this.buffer.append("; ");//$NON-NLS-1$
      for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
        BodyDeclaration d = (BodyDeclaration) it.next();
        d.accept(this);
        // other body declarations include trailing punctuation
      }
    }
    this.buffer.append("}\n");//$NON-NLS-1$
    return false;
View Full Code Here

Examples of org.eclipse.jdt.core.dom.EnumConstantDeclaration

                    return compareNames(bodyDeclaration1, bodyDeclaration2,
                            typeName1, typeName2);

                case ASTNode.ENUM_CONSTANT_DECLARATION:
                    EnumConstantDeclaration enum1 = (EnumConstantDeclaration) bodyDeclaration1;
                    EnumConstantDeclaration enum2 = (EnumConstantDeclaration) bodyDeclaration2;

                    String enumName1 = enum1.getName().getIdentifier();
                    String enumName2 = enum2.getName().getIdentifier();

                    return compareNames(bodyDeclaration1, bodyDeclaration2,
                            enumName1, enumName2);

                case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION:
View Full Code Here

Examples of org.eclipse.jdt.core.dom.EnumConstantDeclaration

  }

  private static EnumConstantDeclaration createNewEnumConstantDeclarataion(
      AST ast, SimpleName constantName, Javadoc docComment,
      Collection annotationCollection) {
    final EnumConstantDeclaration enumConstDecl = ast
        .newEnumConstantDeclaration();
    enumConstDecl.setJavadoc(docComment);
    enumConstDecl.setName(constantName);
    enumConstDecl.modifiers().addAll(annotationCollection);
    return enumConstDecl;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.