org.codehaus.aspectwerkz.annotation.instrumentation.asm
Class AsmAttributeEnhancer

java.lang.Object
  extended byorg.codehaus.aspectwerkz.annotation.instrumentation.asm.AsmAttributeEnhancer
All Implemented Interfaces:
AttributeEnhancer

public class AsmAttributeEnhancer
extends Object
implements AttributeEnhancer

Enhances classes with custom attributes using the ASM library.

Author:
Jonas Bonér , Alexandre Vasseur

Field Summary
 
Fields inherited from interface org.codehaus.aspectwerkz.annotation.instrumentation.AttributeEnhancer
CUSTOM_ATTRIBUTE
 
Constructor Summary
AsmAttributeEnhancer()
           
 
Method Summary
 String[] getNearestInterfacesInHierarchy(String innerClassName)
          Return the first interfaces implemented by a level in the class hierarchy (bottom top)
 boolean initialize(String className, URL[] classPath)
          Initializes the attribute enhancer.
 void insertClassAttribute(Object attribute)
          Inserts an attribute on class level.
 void insertConstructorAttribute(com.thoughtworks.qdox.model.JavaMethod constructor, Object attribute)
          Inserts an attribute on constructor level.
 void insertFieldAttribute(com.thoughtworks.qdox.model.JavaField field, Object attribute)
          Inserts an attribute on field level.
 void insertMethodAttribute(com.thoughtworks.qdox.model.JavaMethod method, Object attribute)
          Inserts an attribute on method level.
static byte[] serialize(Object attribute)
          Serializes the attribute to byte array.
 void write(String destDir)
          Writes the enhanced class to file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsmAttributeEnhancer

public AsmAttributeEnhancer()
Method Detail

initialize

public boolean initialize(String className,
                          URL[] classPath)
Initializes the attribute enhancer. Must always be called before use.

Specified by:
initialize in interface AttributeEnhancer
Parameters:
className - the class name
classPath - the class path
Returns:
true if the class was succefully loaded, false otherwise

insertClassAttribute

public void insertClassAttribute(Object attribute)
Inserts an attribute on class level.

Specified by:
insertClassAttribute in interface AttributeEnhancer
Parameters:
attribute - the attribute

insertFieldAttribute

public void insertFieldAttribute(com.thoughtworks.qdox.model.JavaField field,
                                 Object attribute)
Inserts an attribute on field level.

Specified by:
insertFieldAttribute in interface AttributeEnhancer
Parameters:
field - the QDox java field
attribute - the attribute

insertMethodAttribute

public void insertMethodAttribute(com.thoughtworks.qdox.model.JavaMethod method,
                                  Object attribute)
Inserts an attribute on method level.

Specified by:
insertMethodAttribute in interface AttributeEnhancer
Parameters:
method - the QDox java method
attribute - the attribute

insertConstructorAttribute

public void insertConstructorAttribute(com.thoughtworks.qdox.model.JavaMethod constructor,
                                       Object attribute)
Inserts an attribute on constructor level.

Specified by:
insertConstructorAttribute in interface AttributeEnhancer
Parameters:
constructor - the QDox java method
attribute - the attribute

write

public void write(String destDir)
Writes the enhanced class to file.

Specified by:
write in interface AttributeEnhancer
Parameters:
destDir - the destination directory

serialize

public static byte[] serialize(Object attribute)
Serializes the attribute to byte array.

Parameters:
attribute - the attribute
Returns:
the attribute as a byte array

getNearestInterfacesInHierarchy

public String[] getNearestInterfacesInHierarchy(String innerClassName)
Return the first interfaces implemented by a level in the class hierarchy (bottom top)

Specified by:
getNearestInterfacesInHierarchy in interface AttributeEnhancer
Returns:
nearest superclass (including itself) implemented interfaces


Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.