attrib4j
Class Attributes

java.lang.Object
  |
  +--attrib4j.Attributes

public class Attributes
extends java.lang.Object

This class contains convenience methods to access and test custom attributes. Attributes derive from the class Attribute. The settings of the AttributeFactory will determine which implementation is used to search for metadata associated with program elements.

Version:
$Revision: 1.4 $ $Date: 2003/04/18 23:52:40 $
Author:
Ted Neward, Mark Pollack

Constructor Summary
Attributes()
           
 
Method Summary
static Attribute[] getAttributes(java.lang.Class cls)
          Return the list (possibly empty) of custom attributes associated with the class "cls".
static Attribute[] getAttributes(java.lang.Class cls, java.lang.Class filter)
           
static Attribute[] getAttributes(java.lang.reflect.Field fld)
          Return the list (possibly empty) of custom attributes associated with the field "fld".
static Attribute[] getAttributes(java.lang.reflect.Method method)
          Return all the attributes associated with the given method.
static Attribute[] getAttributes(java.lang.reflect.Method method, java.lang.Class filter)
          Return all the attributes associated with the given method but filtered by the attribute class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Attributes

public Attributes()
Method Detail

getAttributes

public static Attribute[] getAttributes(java.lang.Class cls)
Return the list (possibly empty) of custom attributes associated with the class "cls".

Parameters:
cls - The java.lang.Class object to find the attributes on.
Returns:
The possibly 0-length array of attributes

getAttributes

public static Attribute[] getAttributes(java.lang.Class cls,
                                        java.lang.Class filter)

getAttributes

public static Attribute[] getAttributes(java.lang.reflect.Method method)
Return all the attributes associated with the given method.

Parameters:
method - The java.lang.reflect.Method describing the method.
Returns:
Attribute[] all attributes associated with the method. Returns a 0 length array in case no attributes were found.

getAttributes

public static Attribute[] getAttributes(java.lang.reflect.Method method,
                                        java.lang.Class filter)
Return all the attributes associated with the given method but filtered by the attribute class.

Parameters:
method - The java.lang.reflect.Method describing the method.
filter - Only attributes that are an instanceof this class will be returned.
Returns:
Attribute[] Attributes that are an instance of the filter class on this method will be returned. Returns a 0 length array in case no attributes found.

getAttributes

public static Attribute[] getAttributes(java.lang.reflect.Field fld)
Return the list (possibly empty) of custom attributes associated with the field "fld".

Returns:
The possibly 0-length array of attributes


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