org.compass.core.config.binding.metadata
Class AsmClassMetaData

java.lang.Object
  extended by org.objectweb.asm.commons.EmptyVisitor
      extended by org.compass.core.config.binding.metadata.AsmClassMetaData
All Implemented Interfaces:
ClassMetaData, org.objectweb.asm.AnnotationVisitor, org.objectweb.asm.ClassVisitor, org.objectweb.asm.FieldVisitor, org.objectweb.asm.MethodVisitor

public class AsmClassMetaData
extends org.objectweb.asm.commons.EmptyVisitor
implements ClassMetaData

An ASM based class meta data provider.

Author:
kimchy

Constructor Summary
AsmClassMetaData()
           
 
Method Summary
 Map<String,Object> getAnnotationAttributes(String annotationType)
          Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying class).
 Set<String> getAnnotationTypes()
          Return the names of all annotation types defined on the underlying class.
 String getClassName()
          Return the name of the underlying class.
 String getEnclosingClassName()
          Return the name of the enclosing class of the underlying class, or null if the underlying class is a top-level class.
 String[] getInterfaceNames()
          Return the name of all interfaces that the underlying class implements, or an empty array if there are none.
 Set<String> getMetaAnnotationTypes(String annotationType)
          Return the names of all meta-annotation types defined on the given annotation type of the underlying class.
 String getSuperClassName()
          Return the name of the super class of the underlying class, or null if there is no super class defined.
 boolean hasAnnotation(String annotationType)
          Determine whether the underlying class has an annotation of the given type defined.
 boolean hasEnclosingClass()
          Return whether the underlying class has an enclosing class (i.e. the underlying class is an inner/nested class or a local class within a method).
 boolean hasMetaAnnotation(String metaAnnotationType)
          Determine whether the underlying class has an annotation that is itself annotated with the meta-annotation of the given type.
 boolean hasSuperClass()
          Return whether the underlying class has a super class.
 boolean isAbstract()
          Return whether the underlying class is marked as abstract.
 boolean isConcrete()
          Return whether the underlying class represents a concrete class, i.e. neither an interface nor an abstract class.
 boolean isIndependent()
          Determine whether the underlying class is independent, i.e. whether it is a top-level class or a nested class (static inner class) that can be constructed independent from an enclosing class.
 boolean isInterface()
          Return whether the underlying class represents an interface.
 void visit(int version, int access, String name, String signature, String supername, String[] interfaces)
           
 org.objectweb.asm.AnnotationVisitor visitAnnotation(String desc, boolean visible)
           
 void visitInnerClass(String name, String outerName, String innerName, int access)
           
 void visitOuterClass(String owner, String name, String desc)
           
 
Methods inherited from class org.objectweb.asm.commons.EmptyVisitor
visit, visitAnnotation, visitAnnotationDefault, visitArray, visitAttribute, visitCode, visitEnd, visitEnum, visitField, visitFieldInsn, visitIincInsn, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethod, visitMethodInsn, visitMultiANewArrayInsn, 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

AsmClassMetaData

public AsmClassMetaData()
Method Detail

visit

public void visit(int version,
                  int access,
                  String name,
                  String signature,
                  String supername,
                  String[] interfaces)
Specified by:
visit in interface org.objectweb.asm.ClassVisitor
Overrides:
visit in class org.objectweb.asm.commons.EmptyVisitor

visitOuterClass

public void visitOuterClass(String owner,
                            String name,
                            String desc)
Specified by:
visitOuterClass in interface org.objectweb.asm.ClassVisitor
Overrides:
visitOuterClass in class org.objectweb.asm.commons.EmptyVisitor

visitInnerClass

public void visitInnerClass(String name,
                            String outerName,
                            String innerName,
                            int access)
Specified by:
visitInnerClass in interface org.objectweb.asm.ClassVisitor
Overrides:
visitInnerClass in class org.objectweb.asm.commons.EmptyVisitor

visitAnnotation

public org.objectweb.asm.AnnotationVisitor visitAnnotation(String desc,
                                                           boolean visible)
Specified by:
visitAnnotation in interface org.objectweb.asm.ClassVisitor
Specified by:
visitAnnotation in interface org.objectweb.asm.FieldVisitor
Specified by:
visitAnnotation in interface org.objectweb.asm.MethodVisitor
Overrides:
visitAnnotation in class org.objectweb.asm.commons.EmptyVisitor

getAnnotationTypes

public Set<String> getAnnotationTypes()
Description copied from interface: ClassMetaData
Return the names of all annotation types defined on the underlying class.

Specified by:
getAnnotationTypes in interface ClassMetaData
Returns:
the annotation type names

hasAnnotation

public boolean hasAnnotation(String annotationType)
Description copied from interface: ClassMetaData
Determine whether the underlying class has an annotation of the given type defined.

Specified by:
hasAnnotation in interface ClassMetaData
Parameters:
annotationType - the annotation type to look for
Returns:
whether a matching annotation is defined

getMetaAnnotationTypes

public Set<String> getMetaAnnotationTypes(String annotationType)
Description copied from interface: ClassMetaData
Return the names of all meta-annotation types defined on the given annotation type of the underlying class.

Specified by:
getMetaAnnotationTypes in interface ClassMetaData
Returns:
the meta-annotation type names

hasMetaAnnotation

public boolean hasMetaAnnotation(String metaAnnotationType)
Description copied from interface: ClassMetaData
Determine whether the underlying class has an annotation that is itself annotated with the meta-annotation of the given type.

Specified by:
hasMetaAnnotation in interface ClassMetaData
Parameters:
metaAnnotationType - the meta-annotation type to look for
Returns:
whether a matching meta-annotation is defined

getAnnotationAttributes

public Map<String,Object> getAnnotationAttributes(String annotationType)
Description copied from interface: ClassMetaData
Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying class).

Specified by:
getAnnotationAttributes in interface ClassMetaData
Parameters:
annotationType - the annotation type to look for
Returns:
a Map of attributes, with the attribute name as key (e.g. "value") and the defined attribute value as Map value. This return value will be null if no matching annotation is defined.

getClassName

public String getClassName()
Description copied from interface: ClassMetaData
Return the name of the underlying class.

Specified by:
getClassName in interface ClassMetaData

isInterface

public boolean isInterface()
Description copied from interface: ClassMetaData
Return whether the underlying class represents an interface.

Specified by:
isInterface in interface ClassMetaData

isAbstract

public boolean isAbstract()
Description copied from interface: ClassMetaData
Return whether the underlying class is marked as abstract.

Specified by:
isAbstract in interface ClassMetaData

isConcrete

public boolean isConcrete()
Description copied from interface: ClassMetaData
Return whether the underlying class represents a concrete class, i.e. neither an interface nor an abstract class.

Specified by:
isConcrete in interface ClassMetaData

isIndependent

public boolean isIndependent()
Description copied from interface: ClassMetaData
Determine whether the underlying class is independent, i.e. whether it is a top-level class or a nested class (static inner class) that can be constructed independent from an enclosing class.

Specified by:
isIndependent in interface ClassMetaData

hasEnclosingClass

public boolean hasEnclosingClass()
Description copied from interface: ClassMetaData
Return whether the underlying class has an enclosing class (i.e. the underlying class is an inner/nested class or a local class within a method).

If this method returns false, then the underlying class is a top-level class.

Specified by:
hasEnclosingClass in interface ClassMetaData

getEnclosingClassName

public String getEnclosingClassName()
Description copied from interface: ClassMetaData
Return the name of the enclosing class of the underlying class, or null if the underlying class is a top-level class.

Specified by:
getEnclosingClassName in interface ClassMetaData

hasSuperClass

public boolean hasSuperClass()
Description copied from interface: ClassMetaData
Return whether the underlying class has a super class.

Specified by:
hasSuperClass in interface ClassMetaData

getSuperClassName

public String getSuperClassName()
Description copied from interface: ClassMetaData
Return the name of the super class of the underlying class, or null if there is no super class defined.

Specified by:
getSuperClassName in interface ClassMetaData

getInterfaceNames

public String[] getInterfaceNames()
Description copied from interface: ClassMetaData
Return the name of all interfaces that the underlying class implements, or an empty array if there are none.

Specified by:
getInterfaceNames in interface ClassMetaData


Copyright (c) 2004-2008 The Compass Project.