Example usage for org.eclipse.jdt.core.dom AnnotationTypeMemberDeclaration getType

List of usage examples for org.eclipse.jdt.core.dom AnnotationTypeMemberDeclaration getType

Introduction

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

Prototype

public Type getType() 

Source Link

Document

Returns the type of the annotation type member declared in this declaration.

Usage

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

License:Open Source License

@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    if (node.getJavadoc() != null) {
        node.getJavadoc().accept(this);
    }//  w w  w.ja  v a 2  s  . c om
    printModifiers(node.modifiers());
    node.getType().accept(this);
    this.fBuffer.append(" ");//$NON-NLS-1$
    node.getName().accept(this);
    this.fBuffer.append("()");//$NON-NLS-1$
    if (node.getDefault() != null) {
        this.fBuffer.append(" default ");//$NON-NLS-1$
        node.getDefault().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(AnnotationTypeMemberDeclaration node) {
    List<boa.types.Ast.Method> list = methods.peek();
    Method.Builder b = Method.newBuilder();
    //      b.setPosition(pos.build());
    b.setName(node.getName().getFullyQualifiedName());
    for (Object m : node.modifiers()) {
        if (((IExtendedModifier) m).isAnnotation())
            ((Annotation) m).accept(this);
        else//from   w w  w .  j  a  va 2s .c  o m
            ((org.eclipse.jdt.core.dom.Modifier) m).accept(this);
        b.addModifiers(modifiers.pop());
    }
    boa.types.Ast.Type.Builder tb = boa.types.Ast.Type.newBuilder();
    tb.setName(getIndex(typeName(node.getType())));
    tb.setKind(boa.types.Ast.TypeKind.OTHER);
    b.setReturnType(tb.build());
    if (node.getDefault() != null) {
        boa.types.Ast.Statement.Builder sb = boa.types.Ast.Statement.newBuilder();
        //      sb.setPosition(pos.build());
        sb.setKind(boa.types.Ast.Statement.StatementKind.EXPRESSION);
        node.getDefault().accept(this);
        sb.setExpression(expressions.pop());
        b.addStatements(sb.build());
    }
    list.add(b.build());
    return false;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(AnnotationTypeMemberDeclaration node) {
    if (node.getJavadoc() != null) {
        node.getJavadoc().accept(this);
    }/*from w w w .  ja v  a2s .  c  o  m*/
    printIndent();
    printModifiers(node.modifiers());
    node.getType().accept(this);
    this.buffer.append(" ");//$NON-NLS-1$
    node.getName().accept(this);
    this.buffer.append("()");//$NON-NLS-1$
    if (node.getDefault() != null) {
        this.buffer.append(" default ");//$NON-NLS-1$
        node.getDefault().accept(this);
    }
    this.buffer.append(";\n");//$NON-NLS-1$
    return false;
}

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

License:Apache License

@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    sb.printIndent();//from   w  ww. j  ava2  s .c  o m
    printModifiers(node.getModifiers());
    node.getType().accept(this);
    sb.print(' ');
    node.getName().accept(this);
    sb.print("()");
    if (node.getDefault() != null) {
        sb.print(" default ");
        node.getDefault().accept(this);
    }
    sb.println(';');
    return false;
}

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

License:Apache License

/** Visitor method for {@link AnnotationTypeMemberDeclaration}s. */
@Override//from   www.ja v  a 2  s .c  o m
public boolean visit(AnnotationTypeMemberDeclaration node) {
    sync(node);
    declareOne(node, Direction.VERTICAL, node.modifiers(), node.getType(), VarArgsOrNot.NO,
            ImmutableList.<Annotation>of(), node.getName(), "()", ImmutableList.<Dimension>of(), "default",
            Optional.fromNullable(node.getDefault()), Optional.of(";"), ReceiverParameter.NO);
    return false;
}

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

License:Apache License

@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    sb.printIndent();/*from   w w w  .j  a  va  2  s.c  om*/
    printAnnotations(node.getAnnotations());
    printModifiers(node.getModifiers());
    node.getType().accept(this);
    sb.print(' ');
    node.getName().accept(this);
    sb.print("()");
    if (node.getDefault() != null) {
        sb.print(" default ");
        node.getDefault().accept(this);
    }
    sb.println(';');
    return false;
}

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

License:Open Source License

/**
 * This method writes:/*from w w w. j  av  a2 s.  co  m*/
 *<ul>
 *  <li>For any annotation element declaration:
 *  <ul>
 *    <li>Annotation element entity to <code>IEntityWriter</code>.</li>
 *    <li>Inside relation to <code>IRelationWriter</code>.</li>
 *    <li>Returns relation to <code>IRelationWriter</code>.</li>
 *  </ul></li>
 *</ul>
 */
@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    // Get the fqn
    String fqn = fqnStack.getFqn() + "." + node.getName().getIdentifier() + "()";

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

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

    // Write the returns relation
    Type returnType = node.getType();
    relationWriter.writeReturns(fqn, getTypeFqn(returnType), getLocation(returnType));

    fqnStack.push(fqn, Entity.ANNOTATION_ELEMENT);

    return true;
}

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

License:Open Source License

/**
 * This method writes://from ww w  . ja va 2 s .  co m
 *<ul>
 *  <li>For any annotation element declaration:
 *  <ul>
 *    <li>Annotation element entity to <code>IEntityWriter</code>.</li>
 *    <li>Inside relation to <code>IRelationWriter</code>.</li>
 *    <li>Returns relation to <code>IRelationWriter</code>.</li>
 *  </ul></li>
 *</ul>
 */
@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    // Get the fqn
    String parentFqn = fqnStack.getFqn();
    String fqn = parentFqn + "." + node.getName().getIdentifier();
    String fullFqn = fqn + "()";

    // Push the stack
    fqnStack.push(fullFqn, Entity.ANNOTATION_ELEMENT);

    // Visit the children
    accept(node.getJavadoc());
    accept(node.modifiers());
    accept(node.getType());
    accept(node.getName());
    accept(node.getDefault());

    // Write the entity
    entityWriter.writeEntity(Entity.ANNOTATION_ELEMENT, fqn, "()", null, node.getModifiers(),
            createMetrics(node), createLocation(node));

    // Write the contains relation
    relationWriter.writeRelation(Relation.CONTAINS, parentFqn, fullFqn, createUnknownLocation());

    // Write the returns relation
    Type returnType = node.getType();
    relationWriter.writeRelation(Relation.RETURNS, fullFqn, getTypeFqn(returnType), createLocation(returnType));

    fqnStack.pop();
    return false;
}

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration node) {
    AnnotationTypeMemberDeclaration element = (AnnotationTypeMemberDeclaration) this.binding.get(node);
    this.initializeNode(element, node);
    element.setName(node.getName().getIdentifier());
    endVisitBD(node, element);//from w w  w  .  j  a  va2  s. co m
    if (this.binding.get(node.getType()) != null)
        element.setType((NamedElementRef) this.binding.get(node.getType()));
    if (this.binding.get(node.getDefault()) != null)
        element.setDefault((Expression) this.binding.get(node.getDefault()));
    JDTVisitorUtils.manageBindingDeclaration(element, node.getName(), this);
}

From source file:lang.java.jdt.internal.JdtAstToRascalAstConverter.java

License:Open Source License

public boolean visit(AnnotationTypeMemberDeclaration node) {
    java.util.Map.Entry<IValueList, IValueList> extendedModifiers = parseExtendedModifiers(node.modifiers());
    IValue typeArgument = visitChild(node.getType());
    IValue name = values.string(node.getName().getFullyQualifiedName());
    IValue defaultBlock = node.getDefault() == null ? null : visitChild(node.getDefault());

    ownValue = constructRascalNode(node, extendedModifiers.getKey().asList(),
            extendedModifiers.getValue().asList(), typeArgument, name, optional(defaultBlock));
    return false;
}