Example usage for org.eclipse.jdt.core.dom EnumConstantDeclaration getModifiers

List of usage examples for org.eclipse.jdt.core.dom EnumConstantDeclaration getModifiers

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom EnumConstantDeclaration getModifiers.

Prototype

public int getModifiers() 

Source Link

Document

Returns the modifiers explicitly specified on this declaration.

Usage

From source file:ca.mcgill.cs.swevo.jayfx.ASTCrawler.java

License:Open Source License

@Override
public boolean visit(final EnumConstantDeclaration pNode) {
    // JLS3(8.9): It is impossible to define a local (14.3) enum, or to
    // define an enum in an inner class (8.1.3).
    // assert (aCurrMethodReminder.empty());

    final String lSimpleName = pNode.getName().getIdentifier();
    if (lSimpleName == null)
        return false;

    IElement lField;//w  ww.  j ava 2 s  .  com
    lField = FlyweightElementFactory.getElement(Category.FIELD, this.aCurrType.getId() + "." + lSimpleName);
    this.aDB.addElement(lField, pNode.getModifiers());
    this.aDB.addRelation(this.aCurrType, Relation.DECLARES_FIELD, lField);

    // Register CALLS relationship to constructor
    // IMethodBinding lCBinding = pNode.resolveConstructorBinding();
    // if( checkForNull( lCBinding )) return false;
    // saveMethodRelation( lCBinding );
    // return true;
    return false;
}

From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(EnumConstantDeclaration node) {
    sb.printIndent();//from  ww w  .  j av a2s.  c o m
    printModifiers(node.getModifiers());
    node.getName().accept(this);
    if (!node.getArguments().isEmpty()) {
        sb.print('(');
        for (Iterator<Expression> it = node.getArguments().iterator(); it.hasNext();) {
            Expression e = (Expression) it.next();
            e.accept(this);
            if (it.hasNext()) {
                sb.print(',');
            }
        }
        sb.print(')');
    }
    if (node.getAnonymousClassDeclaration() != null) {
        node.getAnonymousClassDeclaration().accept(this);
    }
    return false;
}

From source file:com.j2swift.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(EnumConstantDeclaration node) {
    sb.printIndent();/*  ww  w  .j  a v  a 2 s.  c om*/
    printAnnotations(node.getAnnotations());
    printModifiers(node.getModifiers());
    node.getName().accept(this);
    if (!node.getArguments().isEmpty()) {
        sb.print('(');
        for (Iterator<Expression> it = node.getArguments().iterator(); it.hasNext();) {
            Expression e = (Expression) it.next();
            e.accept(this);
            if (it.hasNext()) {
                sb.print(',');
            }
        }
        sb.print(')');
    }
    if (node.getAnonymousClassDeclaration() != null) {
        node.getAnonymousClassDeclaration().accept(this);
    }
    return false;
}

From source file:jayfx.ASTCrawler.java

License:Open Source License

public boolean visit(EnumConstantDeclaration pNode) {
    // JLS3(8.9): It is impossible to define a local (14.3) enum, or to define an enum in an inner class (8.1.3).
    assert (aCurrMethodReminder.empty());

    String lSimpleName = pNode.getName().getIdentifier();
    if (lSimpleName == null)
        return false;

    IElement lField;/*from  w ww. j  a  v  a2  s .c o m*/
    lField = FlyweightElementFactory.getElement(ICategories.FIELD, aCurrType.getId() + "." + lSimpleName);
    aDB.addElement(lField, pNode.getModifiers());
    //aDB.addRelation( aCurrType, Relation.DECLARES, lField );
    aDB.addRelationAndTranspose(aCurrType, Relation.DECLARES, lField);
    //   Register CALLS relationship to constructor
    //      IMethodBinding lCBinding = pNode.resolveConstructorBinding();
    //      if( checkForNull( lCBinding )) return false;
    //      saveMethodRelation( lCBinding );
    //      return true; 
    return false;
}

From source file:org.whole.lang.java.util.JDTTransformerVisitor.java

License:Open Source License

@Override
public boolean visit(EnumConstantDeclaration node) {
    org.whole.lang.java.model.EnumConstantDeclaration enumConstantDeclaration;
    appendBodyDeclaration(/*from  ww w .j  a  v  a2s. c  o  m*/
            enumConstantDeclaration = createResolver(JavaEntityDescriptorEnum.EnumConstantDeclaration));

    if (acceptChild(node.getJavadoc()))
        enumConstantDeclaration.setJavadoc(this.javadoc);

    List<?> modifiers = node.modifiers();
    if (!modifiers.isEmpty()) {
        enumConstantDeclaration.setModifiers(lf.create(JavaEntityDescriptorEnum.ExtendedModifiers));
        setExtendedModifiers(enumConstantDeclaration.getModifiers(), modifiers);
    }
    if (acceptChild(node.getName()))
        enumConstantDeclaration.setName((org.whole.lang.java.model.SimpleName) this.name);

    Iterator<?> i = node.arguments().iterator();
    while (i.hasNext()) {
        ((ASTNode) i.next()).accept(this);
        enumConstantDeclaration.getArguments().wAdd(this.exp);
    }

    if (acceptChild(node.getAnonymousClassDeclaration()))
        enumConstantDeclaration.setAnonymousClassDeclaration(this.anonymousClassDeclaration);

    return false;
}