Example usage for org.eclipse.jdt.core.dom AnnotationTypeDeclaration getName

List of usage examples for org.eclipse.jdt.core.dom AnnotationTypeDeclaration getName

Introduction

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

Prototype

public SimpleName getName() 

Source Link

Document

Returns the name of the type declared in this type declaration.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(AnnotationTypeDeclaration node) {
    if (node.getJavadoc() != null) {
        node.getJavadoc().accept(this);
    }/*from  w ww.jav a2  s  . co  m*/
    printModifiers(node.modifiers());
    this.fBuffer.append("@interface ");//$NON-NLS-1$
    node.getName().accept(this);
    this.fBuffer.append(" {");//$NON-NLS-1$
    for (Iterator<BodyDeclaration> it = node.bodyDeclarations().iterator(); it.hasNext();) {
        BodyDeclaration d = it.next();
        d.accept(this);
    }
    this.fBuffer.append("}");//$NON-NLS-1$
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(AnnotationTypeDeclaration node) {
    boa.types.Ast.Declaration.Builder b = boa.types.Ast.Declaration.newBuilder();
    //      b.setPosition(pos.build());
    b.setName(node.getName().getFullyQualifiedName());
    b.setKind(boa.types.Ast.TypeKind.ANNOTATION);
    // TODO//from w  ww  . j av a  2  s.com
    declarations.peek().add(b.build());
    return false;
}

From source file:br.uff.ic.mergeguider.javaparser.DepVisitor.java

@Override
public boolean visit(AnnotationTypeDeclaration node) {

    String className;//  w w w.  j  a v  a 2 s  .  c o  m

    PackageDeclaration aPackage = cu.getPackage();
    if (aPackage != null) {
        String packageName = aPackage.getName().getFullyQualifiedName();
        className = packageName + "." + node.getName().getIdentifier();
    } else {
        className = null;
    }

    classLanguageContructs = new ClassLanguageContructs(className, path);
    classLanguageConstructsList.add(classLanguageContructs);

    simpleNames = new ArrayList<>();
    simpleNamesList.add(simpleNames);

    //Treating location and language construct
    Location location;

    int elementLineBegin = cu.getLineNumber(node.getStartPosition());
    int elementLineEnd = cu.getLineNumber(node.getStartPosition() + node.getLength());
    int elementColumnBegin = cu.getColumnNumber(node.getStartPosition());
    int elementColumnEnd = cu.getColumnNumber(node.getStartPosition() + node.getLength());

    location = new Location(elementLineBegin, elementLineEnd, elementColumnBegin, elementColumnEnd);

    MyAnnotationDeclaration annotationDeclaration = new MyAnnotationDeclaration(node, location);

    if (!classLanguageConstructsList.isEmpty()) {
        classLanguageConstructsList.get(classLanguageConstructsList.size() - 1).getAnnotationDeclarations()
                .add(annotationDeclaration);
    }

    return true;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(AnnotationTypeDeclaration node) {
    if (node.getJavadoc() != null) {
        node.getJavadoc().accept(this);
    }//ww w .jav a 2  s  . co  m
    printIndent();
    printModifiers(node.modifiers());
    this.buffer.append("@interface ");//$NON-NLS-1$
    node.getName().accept(this);
    this.buffer.append(" {");//$NON-NLS-1$
    for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
        BodyDeclaration d = (BodyDeclaration) it.next();
        d.accept(this);
    }
    this.buffer.append("}\n");//$NON-NLS-1$
    return false;
}

From source file:com.bsiag.eclipse.jdt.java.formatter.LineBreaksPreparator.java

License:Open Source License

@Override
public boolean visit(AnnotationTypeDeclaration node) {
    handleBracedCode(node, node.getName(), this.options.brace_position_for_annotation_type_declaration,
            this.options.indent_body_declarations_compare_to_annotation_declaration_header,
            this.options.insert_new_line_in_empty_annotation_declaration);

    handleBodyDeclarations(node.bodyDeclarations());
    if (node.getModifiers() == 0)
        this.tm.firstTokenBefore(node.getName(), TokenNameAT).breakBefore();

    this.declarationModifierVisited = false;
    return true;//from w  ww .  j a va2s.  com
}

From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java

License:Open Source License

@Override
public boolean visit(AnnotationTypeDeclaration node) {
    handleToken(node, TokenNameAT, this.options.insert_space_before_at_in_annotation_type_declaration,
            this.options.insert_space_after_at_in_annotation_type_declaration);
    handleToken(node.getName(), TokenNameLBRACE,
            this.options.insert_space_before_opening_brace_in_annotation_type_declaration, false);
    return true;//from   w w w.  j  a v  a2s.  c  o  m
}

From source file:com.codenvy.ide.ext.java.server.internal.core.util.DOMFinder.java

License:Open Source License

public boolean visit(AnnotationTypeDeclaration node) {
    if (found(node, node.getName()) && this.resolveBinding)
        this.foundBinding = node.resolveBinding();
    return true;//from w ww .  j a v a2s . co  m
}

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

License:Apache License

@Override
public boolean visit(AnnotationTypeDeclaration node) {
    sb.printIndent();/*from  w  w w.  ja  va2s  . c o  m*/
    printAnnotations(node.getAnnotations());
    printModifiers(node.getModifiers());
    sb.print("@interface ");
    node.getName().accept(this);
    sb.println(" {");
    sb.indent();
    for (BodyDeclaration decl : node.getBodyDeclarations()) {
        decl.accept(this);
    }
    sb.unindent();
    sb.println("}");
    return false;
}

From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java

License:Apache License

/** Visitor method for {@link AnnotationTypeDeclaration}s. */
@Override/*from   w  w w  . j a  v a 2s .c  o m*/
public boolean visit(AnnotationTypeDeclaration node) {
    sync(node);
    builder.open(ZERO);
    visitAndBreakModifiers(node.modifiers(), Direction.VERTICAL, Optional.<BreakTag>absent());
    builder.open(ZERO);
    token("@");
    token("interface");
    builder.breakOp(" ");
    visit(node.getName());
    builder.close();
    builder.close();
    if (node.bodyDeclarations() == null) {
        builder.open(plusFour);
        token(";");
        builder.close();
    } else {
        addBodyDeclarations(node.bodyDeclarations(), BracesOrNot.YES, FirstDeclarationsOrNot.YES);
    }
    builder.guessToken(";");
    return false;
}

From source file:edu.uci.ics.sourcerer.extractor.ast.ReferenceExtractorVisitor.java

License:Open Source License

/**
 * This method writes:/*w  ww. ja v a 2s.c  om*/
 *<ul>
 *  <li>For any annotation declaration:
 *  <ul>
 *    <li>Annotation entity to <code>IEntityWriter</code>.</li>
 *    <li>Inside relation to <code>IRelationWriter</code>.</li>
 *  </ul></li>
 *</ul>
 */
@SuppressWarnings("unchecked")
@Override
public boolean visit(AnnotationTypeDeclaration node) {
    // Get the fqn
    String fqn = null;
    if (node.isPackageMemberTypeDeclaration()) {
        fqn = fqnStack.getTypeFqn(node.getName().getIdentifier());
    } else if (node.isMemberTypeDeclaration()) {
        if (node.getName().getIdentifier().length() > 0) {
            fqn = fqnStack.getMemberFqn(node.getName().getIdentifier());
        } else {
            logger.severe("A annotation declaration should not declare an annonymous type!");
            fqn = fqnStack.getAnonymousClassFqn();
        }
    } else if (node.isLocalTypeDeclaration()) {
        ITypeBinding binding = node.resolveBinding();
        fqn = fqnStack.getLocalFqn(node.getName().getIdentifier(), binding);
    } else {
        logger.severe("Unsure what type the declaration is!");
        fqn = "(ERROR)" + node.getName().getIdentifier();
    }

    // Write the entity
    entityWriter.writeAnnotation(fqn, node.getModifiers(),
            MetricsCalculator.computeLinesOfCode(getSource(node)), getLocation(node));

    // Write the inside relation
    relationWriter.writeInside(fqn, fqnStack.getFqn(), getUnknownLocation());

    fqnStack.push(fqn, Entity.ANNOTATION);

    accept(node.getJavadoc());
    accept(node.bodyDeclarations());

    return false;
}