org.apache.felix.ipojo.manipulation.annotations
Class CustomAnnotationVisitor

java.lang.Object
  extended by org.objectweb.asm.commons.EmptyVisitor
      extended by org.apache.felix.ipojo.manipulation.annotations.CustomAnnotationVisitor
All Implemented Interfaces:
org.objectweb.asm.AnnotationVisitor, org.objectweb.asm.ClassVisitor, org.objectweb.asm.FieldVisitor, org.objectweb.asm.MethodVisitor

public class CustomAnnotationVisitor
extends org.objectweb.asm.commons.EmptyVisitor
implements org.objectweb.asm.AnnotationVisitor

Collect metadata from custom annotation.

Author:
Felix Project Team

Constructor Summary
CustomAnnotationVisitor(Element elem, MetadataCollector collector, boolean root, boolean clazz)
          Constructor.
CustomAnnotationVisitor(Element elem, MetadataCollector collector, boolean root, boolean clazz, int index, String descriptor)
          Constructor used for parameter annotations
 
Method Summary
static Element buildElement(String desc)
          Build the element object from the given descriptor.
static boolean isCustomAnnotation(String desc)
          Check if the given annotation descriptor is an iPOJO custom annotation.
 void visit(String arg0, Object arg1)
          Visit a 'simple' annotation attribute.
 org.objectweb.asm.AnnotationVisitor visitAnnotation(String arg0, String arg1)
          Visit a sub-annotation.
 org.objectweb.asm.AnnotationVisitor visitArray(String arg0)
          Visit an array attribute.
 void visitEnd()
          End of the visit.
 void visitEnum(String arg0, String arg1, String arg2)
          Visits an enumeration attribute.
 
Methods inherited from class org.objectweb.asm.commons.EmptyVisitor
visit, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitField, visitFieldInsn, visitFrame, visitIincInsn, visitInnerClass, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethod, visitMethodInsn, visitMultiANewArrayInsn, visitOuterClass, visitParameterAnnotation, visitSource, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn, visitVarInsn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomAnnotationVisitor

public CustomAnnotationVisitor(Element elem,
                               MetadataCollector collector,
                               boolean root,
                               boolean clazz)
Constructor.

Parameters:
elem - the parent element
collector - the metadata collector
root - is the annotation a root
clazz - the annotation is a class annotation.

CustomAnnotationVisitor

public CustomAnnotationVisitor(Element elem,
                               MetadataCollector collector,
                               boolean root,
                               boolean clazz,
                               int index,
                               String descriptor)
Constructor used for parameter annotations

Parameters:
elem - the parent element
collector - the metadata collector
root - is the annotation a root
clazz - the annotation is a class annotation.
index - the index of the argument
the - descriptor of the method
Method Detail

isCustomAnnotation

public static boolean isCustomAnnotation(String desc)
Check if the given annotation descriptor is an iPOJO custom annotation. A valid iPOJO custom annotation must contains 'ipojo' or 'handler' in its qualified name.

Parameters:
desc - : annotation descriptor
Returns:
: true if the given descriptor is an iPOJO custom annotation

buildElement

public static Element buildElement(String desc)
Build the element object from the given descriptor.

Parameters:
desc - : annotation descriptor
Returns:
: the element

visit

public void visit(String arg0,
                  Object arg1)
Visit a 'simple' annotation attribute. This method is used for primitive arrays too.

Specified by:
visit in interface org.objectweb.asm.AnnotationVisitor
Overrides:
visit in class org.objectweb.asm.commons.EmptyVisitor
Parameters:
arg0 - : attribute name
arg1 - : attribute value
See Also:
EmptyVisitor.visit(java.lang.String, java.lang.Object)

visitAnnotation

public org.objectweb.asm.AnnotationVisitor visitAnnotation(String arg0,
                                                           String arg1)
Visit a sub-annotation.

Specified by:
visitAnnotation in interface org.objectweb.asm.AnnotationVisitor
Overrides:
visitAnnotation in class org.objectweb.asm.commons.EmptyVisitor
Parameters:
arg0 - : attribute name.
arg1 - : annotation description
Returns:
an annotation visitor which will visit the given annotation
See Also:
EmptyVisitor.visitAnnotation(java.lang.String, java.lang.String)

visitArray

public org.objectweb.asm.AnnotationVisitor visitArray(String arg0)
Visit an array attribute.

Specified by:
visitArray in interface org.objectweb.asm.AnnotationVisitor
Overrides:
visitArray in class org.objectweb.asm.commons.EmptyVisitor
Parameters:
arg0 - : attribute name
Returns:
a visitor which will visit each element of the array
See Also:
EmptyVisitor.visitArray(java.lang.String)

visitEnum

public void visitEnum(String arg0,
                      String arg1,
                      String arg2)
Visits an enumeration attribute.

Specified by:
visitEnum in interface org.objectweb.asm.AnnotationVisitor
Overrides:
visitEnum in class org.objectweb.asm.commons.EmptyVisitor
Parameters:
arg0 - the attribute name
arg1 - the enumeration descriptor
arg2 - the attribute value
See Also:
AnnotationVisitor.visitEnum(java.lang.String, java.lang.String, java.lang.String)

visitEnd

public void visitEnd()
End of the visit. All attribute was visited, we can update collectors data.

Specified by:
visitEnd in interface org.objectweb.asm.AnnotationVisitor
Specified by:
visitEnd in interface org.objectweb.asm.ClassVisitor
Specified by:
visitEnd in interface org.objectweb.asm.FieldVisitor
Specified by:
visitEnd in interface org.objectweb.asm.MethodVisitor
Overrides:
visitEnd in class org.objectweb.asm.commons.EmptyVisitor
See Also:
EmptyVisitor.visitEnd()


Copyright © 2011 Apache Software Foundation. All Rights Reserved.