Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.AnnotationNode


    super.transform(cn);
  }

  private void removeAnnotation(Iterator i) {
    while (i.hasNext()) {
      AnnotationNode an = (AnnotationNode) i.next();
      if (annotationDesc.equals(an.desc)) {
        i.remove();
      }
    }
  }
View Full Code Here


    cn.version = (cn.version & 0xFF) < V1_5 ? V1_5 : cn.version;
    boolean isPresent = false;
    if (cn.visibleAnnotations != null) {
      Iterator i = cn.visibleAnnotations.iterator();
      while (i.hasNext()) {
        AnnotationNode an = (AnnotationNode) i.next();
        if (annotationDesc.equals(an.desc)) {
          isPresent = true;
          break;
        }
      }
    }
    if (!isPresent) {
      if (cn.visibleAnnotations == null) {
        cn.visibleAnnotations = new ArrayList(5);
      }
      cn.visibleAnnotations.add(new AnnotationNode(annotationDesc));
    }
    super.transform(cn);
  }
View Full Code Here

    }
    // TestNG Class annotation and public method.
    if (cn.visibleAnnotations != null) {
      if ((mn.access & ACC_PUBLIC) != 0) {
        for (Object oca : cn.visibleAnnotations) {
          AnnotationNode ca = (AnnotationNode) oca;
          if (ca.desc.equals("Lorg/testng/annotations/Test;")) {
            return true;
          }
        }
      }
    }
    // Various method level annotation
    if (mn.visibleAnnotations != null) {
      for (Object oan : mn.visibleAnnotations) {
        AnnotationNode an = (AnnotationNode) oan;
        if (annotationsSet.contains(an.desc)) {
          return true;
        }
      }
    }
View Full Code Here

    assertFalse(selector.shouldVisit(cn, mn));

    List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
    mn.visibleAnnotations = annotations;
    assertFalse(selector.shouldVisit(cn, mn));
    annotations.add(new AnnotationNode( "whatever" ));
    assertFalse(selector.shouldVisit(cn, mn));   
    annotations.add( new AnnotationNode(
        PurrPackageSelector.ANNOTATIONS_TO_INSTRUMENT[2]));
    assertTrue(selector.shouldVisit(cn, mn));
    mn.name = "<init>";
    assertFalse(selector.shouldVisit(cn, mn));
    // cn.visibleAnnotations
View Full Code Here

                return annotationType.cast(result);
            }

            private Object buildAnnotation(String className)
            {
                AnnotationNode node = nameToNode.get(className);

                if (node == null)
                    return null;

                return createAnnotation(className, node);
View Full Code Here

   * Build {@link ComponentBean}.
   */
  private void applyComponent(final ComponentBean component,
      final Class<?> type, final ClassNode classNode) throws Exception {

    final AnnotationNode annoNode = UtilAsm.componentAnno(classNode);

    if (annoNode == null) {
      return;
    }

View Full Code Here

      return;
    }

    for (final FieldNode fieldNode : fieldList) {

      final AnnotationNode annoNode = UtilAsm.propertyAnno(fieldNode);

      if (annoNode == null) {
        continue;
      }
View Full Code Here

      return;
    }

    for (final MethodNode methodNode : methodList) {

      final AnnotationNode annoNode = UtilAsm.referenceAnno(methodNode);

      if (annoNode == null) {
        continue;
      }
View Full Code Here

  public static boolean hasComponentAnno(final Class<?> klaz)
      throws Exception {

    final ClassNode node = classNode(klaz);

    final AnnotationNode anno = componentAnno(node);

    return anno != null;

  }
View Full Code Here

    ClassNode node = getNode();

    if (node.visibleAnnotations != null) {
      for (int i = 0, j = node.visibleAnnotations.size(); i < j; i++) {
        AnnotationNode ann = (AnnotationNode)node.visibleAnnotations.get(i);
        String descriptor = "L" + name.replace(".", "/") + ";";

        if (ann.desc.equals(descriptor)) {
          return ann;
        }
View Full Code Here

TOP

Related Classes of org.objectweb.asm.tree.AnnotationNode

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.