Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.Annotation


    protected void processModifiersOfMethodDeclaration( MethodDeclaration methodDeclaration,
                                                        MethodMetadata methodMetadata ) {
        List<IExtendedModifier> extendedModifiers = methodDeclaration.modifiers();
        for (IExtendedModifier extendedModifier : extendedModifiers) {
            if (extendedModifier.isAnnotation()) {
                Annotation annotation = (Annotation)extendedModifier;
                methodMetadata.getAnnotations().add(createAnnotationMetadataFor(annotation));
            } else {
                Modifier modifier = (Modifier)extendedModifier;
                methodMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString()));
            }
View Full Code Here


          MethodDeclaration stub = ast.newMethodDeclaration();
          stub.setConstructor(false);
          stub.modifiers().addAll(ast.newModifiers(Modifier.PUBLIC));

          Annotation marker = ast.newMarkerAnnotation();
          marker.setTypeName(ast.newSimpleName("Test"));
          astRewrite
            .getListRewrite(stub, MethodDeclaration.MODIFIERS2_PROPERTY)
            .insertFirst(marker, null);

          stub.setName(ast.newSimpleName(name));
View Full Code Here

    if (node.getAST().apiLevel() >= JLS3) {
      if (node.getJavadoc() != null) {
        node.getJavadoc().accept(this);
      }
      for (Iterator it = node.annotations().iterator(); it.hasNext(); ) {
        Annotation p = (Annotation) it.next();
        p.accept(this);
        this.buffer.append(" ");//$NON-NLS-1$
      }
    }
    printIndent();
    this.buffer.append("package ");//$NON-NLS-1$
View Full Code Here

        Set<String> newAnnotationTypes = new HashSet<String>();
        int lastAnnotationIndex = 0;
        int idx = 0;
        for (Object modifier : node.modifiers()) {
            if (modifier instanceof Annotation) {
                Annotation newAnnotation = (Annotation) modifier;
                newAnnotationTypes.add(newAnnotation.getTypeName()
                        .getFullyQualifiedName());
                lastAnnotationIndex = idx;
            }
            idx++;
        }
View Full Code Here

  private static boolean hasPushAssists(TestNGVisitor visitor) {
    return visitor.getTestClassAnnotation() != null;
  }

  private static boolean hasPullAssists(TestNGVisitor visitor) {
    Annotation testClass = visitor.getTestClassAnnotation();
    return visitor.getTestMethods().size() > 0 && testClass == null;
  }
View Full Code Here

  }

  private Annotation getAnnotation(List<IExtendedModifier> modifiers, String annotation) {
    for (IExtendedModifier m : modifiers) {
      if (m.isAnnotation()) {
        Annotation a = (Annotation) m;
        if (annotation.equals(a.getTypeName().toString())) {
          return a;
        }
      }
    }
View Full Code Here

    //
    // Replace @Ignore with @Test(enabled = false)
    //
    for (Map.Entry<MethodDeclaration, Annotation> e : visitor.getIgnoredMethods().entrySet()) {
      MethodDeclaration md = e.getKey();
      Annotation ignored = e.getValue();
      // Add the @Test(enabled = false)
      NormalAnnotation test = ast.newNormalAnnotation();
      test.setTypeName(ast.newName("Test"));
      MemberValuePair mvp = ast.newMemberValuePair();
      mvp.setName(ast.newSimpleName("enabled"));
View Full Code Here

  /**
   * @return a NormalAnnotation if the annotation to create has attributes or a
   * MarkerAnnotation otherwise.
   */
  private Annotation createAnnotation(AST ast, String name, Map<String, Boolean> attributes) {
    Annotation result = null;
    NormalAnnotation normalAnnotation = null;
    if (attributes != null && attributes.size() > 0) {
      normalAnnotation = ast.newNormalAnnotation();
      result = normalAnnotation;
    } else {
      result = ast.newMarkerAnnotation();
    }
    result.setTypeName(ast.newName(name));
    if (attributes != null) {
      for (Entry<String, Boolean> a : attributes.entrySet()) {
        MemberValuePair mvp = ast.newMemberValuePair();
        mvp.setName(ast.newSimpleName(a.getKey()));
        mvp.setValue(ast.newBooleanLiteral(a.getValue()));
View Full Code Here

  private MemberValuePair getAttribute(MethodDeclaration md, String attribute) {
    @SuppressWarnings("unchecked")
    List<IExtendedModifier> modifiers = md.modifiers();
    for (IExtendedModifier m : modifiers) {
      if (m.isAnnotation()) {
        Annotation a = (Annotation) m;
        if ("Test".equals(a.getTypeName().toString()) && a instanceof NormalAnnotation) {
          NormalAnnotation na = (NormalAnnotation) a;
          for (Object o : na.values()) {
            MemberValuePair mvp = (MemberValuePair) o;
            if (mvp.getName().toString().equals(attribute)) return mvp;
          }
View Full Code Here

      @SuppressWarnings("unchecked")
      boolean hasTestNGAnnotation = false;
      List<IExtendedModifier> modifiers = md.modifiers();
      for (IExtendedModifier m : modifiers) {
        if (m.isAnnotation()) {
          Annotation a = (Annotation) m;
          IAnnotationBinding ab = a.resolveAnnotationBinding();
          String typeName = ab.getAnnotationType().getBinaryName();
          if (typeName.contains("org.testng")) {
            hasTestNGAnnotation = true;
            break;
          }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.Annotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.