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

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

Introduction

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

Prototype

public Expression getDefault() 

Source Link

Document

Returns the default value of this annotation type member, or null if there is none.

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);
    }/*from  www  .ja  v  a2 s. c o  m*/
    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/* w ww  . j  a  v  a2 s  . 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   www.  j a  va2 s .  co  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.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java

License:Open Source License

@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    handleToken(node.getName(), TokenNameIdentifier, true, false);
    handleToken(node.getName(), TokenNameLPAREN,
            this.options.insert_space_before_opening_paren_in_annotation_type_member_declaration, false);
    handleEmptyParens(node.getName(),/*from w  w  w.j av  a  2s  .co  m*/
            this.options.insert_space_between_empty_parens_in_annotation_type_member_declaration);
    if (node.getDefault() != null)
        handleTokenBefore(node.getDefault(), TokenNamedefault, true, true);
    return true;
}

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

License:Apache License

@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
    sb.printIndent();//ww  w  .ja v  a 2s. c  om
    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 w  ww.j  a  v  a 2 s.  co 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();/*w ww . j  a v  a  2  s  . c o m*/
    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.tools.java.extractor.eclipse.ReferenceExtractorVisitor.java

License:Open Source License

/**
 * This method writes:/*from   w  ww.j a va2s .c o 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);/*  w w w  .j a  v a2  s. com*/
    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;
}