List of usage examples for org.eclipse.jdt.core.dom AnnotationTypeMemberDeclaration getName
public SimpleName getName()
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 ww w . ja v a2 s . co 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//from w w w . j a v a 2s. c om ((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 . 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.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(),/* w ww . j a v a 2 s.c o 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.codenvy.ide.ext.java.server.internal.core.util.DOMFinder.java
License:Open Source License
public boolean visit(AnnotationTypeMemberDeclaration node) { if (found(node, node.getName()) && this.resolveBinding) this.foundBinding = node.resolveBinding(); return true;//from ww w .java 2 s . com }
From source file:com.google.devtools.j2objc.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*/ 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 ww w . jav a 2 s . com 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 ava 2s . co 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:de.fkoeberle.autocommit.message.java.helper.DeclarationListDeltaTest.java
License:Open Source License
@Test public void testRenamedAnnotationMember() { DeclarationListDelta listDelta = createAnnotationDelta("String id();", "String name();"); assertEquals(1, listDelta.getAddedDeclarations().size()); assertEquals(0, listDelta.getChangedDeclarations().size()); assertEquals(1, listDelta.getRemovedDeclarations().size()); BodyDeclaration removedDeclaration = listDelta.getRemovedDeclarations().get(0); assertTrue(removedDeclaration instanceof AnnotationTypeMemberDeclaration); AnnotationTypeMemberDeclaration removedAnnotationTypeMember = (AnnotationTypeMemberDeclaration) removedDeclaration; assertEquals("id", removedAnnotationTypeMember.getName().getIdentifier()); BodyDeclaration addedDeclaration = listDelta.getAddedDeclarations().get(0); assertTrue(addedDeclaration instanceof AnnotationTypeMemberDeclaration); AnnotationTypeMemberDeclaration addedAnnotationTypeMember = (AnnotationTypeMemberDeclaration) addedDeclaration; assertEquals("name", addedAnnotationTypeMember.getName().getIdentifier()); }
From source file:edu.uci.ics.sourcerer.extractor.ast.ReferenceExtractorVisitor.java
License:Open Source License
/** * This method writes:/*w w w.java 2 s .com*/ *<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; }