attrib4j
Interface AttributeExtractor

All Known Implementing Classes:
BCELAttributeExtractor, CFParseAttributeExtractor

public interface AttributeExtractor

Methods that should be implemented in order to extract attributes associate with a class. An implementation this class needs to be provided for each bytecode manipulation library or other meta-data storage mechanism that is supported. TODO add utility method to get attributes of certain classes, or for methods of certain signatures.

Version:
$Id: AttributeExtractor.java,v 1.9 2003/04/18 23:52:41 markpollack Exp $
Author:
Mark Pollack

Method Summary
 void close()
          Close any resouces that were opened.
 Attribute[] getClassAttributes()
          Retreives attributes associated with the class.
 Attribute[] getClassAttributes(java.lang.Class filter)
          Retrieves attributes associated with the class of a given type.
 Attribute[] getFieldAttributes(java.lang.String fieldName)
          Retreives custom attributes applied to a specific field of the class.
 Attribute[] getMethodAttributes(java.lang.String methodName, java.lang.String[] methodParamTypes)
          Retreives custom attributes applied to a specific method of the class.
 Attribute[] getMethodAttributes(java.lang.String methodName, java.lang.String[] methodParamTypes, java.lang.Class filter)
          Retreives custom attributes applied to a specific method of the class filtered by a particular attribute class.
 void open(java.lang.String qualifiedClassname, java.lang.ClassLoader cl)
          Using the provided class loader, load the class so that it can be passed to a bytecode manipulation library.
 

Method Detail

open

public void open(java.lang.String qualifiedClassname,
                 java.lang.ClassLoader cl)
Using the provided class loader, load the class so that it can be passed to a bytecode manipulation library.

Parameters:
qualifiedClassname - The fully qualified classname - contains package information, ie java.lang.String
cl - Classload to user to load the class.

close

public void close()
Close any resouces that were opened.


getClassAttributes

public Attribute[] getClassAttributes()
Retreives attributes associated with the class.

Returns:
An array of attributes that satisfy the instanceof comparison with the filter class. Null if there are no attributes associated with the class.

getClassAttributes

public Attribute[] getClassAttributes(java.lang.Class filter)
Retrieves attributes associated with the class of a given type.

Parameters:
filter - The class object used to filter the returned attribute classes.
Returns:
An array of attributes that satisfy the instanceof comparison with the filter class.

getMethodAttributes

public Attribute[] getMethodAttributes(java.lang.String methodName,
                                       java.lang.String[] methodParamTypes)
Retreives custom attributes applied to a specific method of the class.

Parameters:
methodName - The name of the method.
methodParamTypes - The signature of the method.
Returns:
An array of custom attributes. Null if there are no attributes.

getMethodAttributes

public Attribute[] getMethodAttributes(java.lang.String methodName,
                                       java.lang.String[] methodParamTypes,
                                       java.lang.Class filter)
Retreives custom attributes applied to a specific method of the class filtered by a particular attribute class.

Parameters:
methodName - The name of the method.
methodParamTypes - The signature of the method.
filter - The class object used to filter the returned attribute classes.
Returns:
An array of custom attributes. Null if there are no attributes.

getFieldAttributes

public Attribute[] getFieldAttributes(java.lang.String fieldName)
Retreives custom attributes applied to a specific field of the class.

Parameters:
fieldName - the name of a class field.
Returns:
An array of custom attributes. Null if there are no attributes.


Copyright © 2002-2003 Mark Pollack. All Rights Reserved.