org.springframework.metadata.commons
Class CommonsAttributes

java.lang.Object
  extended byorg.springframework.metadata.commons.CommonsAttributes
All Implemented Interfaces:
Attributes

public class CommonsAttributes
extends java.lang.Object
implements Attributes

Implementation of the Spring Attributes facade for Commons Attributes.

Please see the Commons Attributes documentation for information on how to use the attribute compiler.

As of December 2003, follow the Javadocs to the AttributeCompiler class to see how the Ant task works. Note that you need to put the following jars in your $ANT_HOME/lib directory for the Common Attributes compiler to work:

You need to perform the attribute compilation step before compiling your source.

See build.xml in the tests for package org.springframework.aop.autoproxy.metadata for an example of the required Ant scripting. The header of this build script includes some quick, and hopefully useful, hints on using Commons Attributes. The source files in the same package (TxClass and TxClassWithClassAttribute) illustrate attribute usage in source files.

The Spring Framework project does not provide support usage of specific attributes implementations. Please refer to the appropriate site and mailing list of the attributes implementation.

Version:
$Id: CommonsAttributes.java,v 1.3 2004/03/18 02:46:17 trisberg Exp $
Author:
Rod Johnson

Constructor Summary
CommonsAttributes()
           
 
Method Summary
 java.util.Collection getAttributes(java.lang.Class targetClass)
          Return the class attributes of the target class.
 java.util.Collection getAttributes(java.lang.Class targetClass, java.lang.Class filter)
          Return the class attributes of the target class of a given type.
 java.util.Collection getAttributes(java.lang.reflect.Field targetField)
          Return the field attributes of the target field.
 java.util.Collection getAttributes(java.lang.reflect.Field targetField, java.lang.Class filter)
          Return the field attributes of the target method of a given type.
 java.util.Collection getAttributes(java.lang.reflect.Method targetMethod)
          Return the method attributes of the target method.
 java.util.Collection getAttributes(java.lang.reflect.Method targetMethod, java.lang.Class filter)
          Return the method attributes of the target method of a given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonsAttributes

public CommonsAttributes()
Method Detail

getAttributes

public java.util.Collection getAttributes(java.lang.Class targetClass)
Description copied from interface: Attributes
Return the class attributes of the target class.

Specified by:
getAttributes in interface Attributes
Parameters:
targetClass - the class that contains attribute information
Returns:
a collection of attributes, possibly an empty collection, never null

getAttributes

public java.util.Collection getAttributes(java.lang.Class targetClass,
                                          java.lang.Class filter)
Description copied from interface: Attributes
Return the class attributes of the target class of a given type. The class attributes are filtered by providing a java.lang.Class reference to indicate the type to filter on. This is useful if you know the type of the attribute you are looking for and don't want to sort through the unfiltered Collection yourself.

Specified by:
getAttributes in interface Attributes
Parameters:
targetClass - the class that contains attribute information
filter - specify that only this type of class should be returned
Returns:
return only the Collection of attributes that are of the filter type

getAttributes

public java.util.Collection getAttributes(java.lang.reflect.Method targetMethod)
Description copied from interface: Attributes
Return the method attributes of the target method.

Specified by:
getAttributes in interface Attributes
Parameters:
targetMethod - the method that contains attribute information
Returns:
a Collection of attributes, possibly an empty Collection, never null

getAttributes

public java.util.Collection getAttributes(java.lang.reflect.Method targetMethod,
                                          java.lang.Class filter)
Description copied from interface: Attributes
Return the method attributes of the target method of a given type. The method attributes are filtered by providing a java.lang.Class reference to indicate the type to filter on. This is useful if you know the type of the attribute you are looking for and don't want to sort through the unfiltered Collection yourself.

Specified by:
getAttributes in interface Attributes
Parameters:
targetMethod - the method that contains attribute information
filter - specify that only this type of class should be returned
Returns:
a Collection of attributes, possibly an empty Collection, never null

getAttributes

public java.util.Collection getAttributes(java.lang.reflect.Field targetField)
Description copied from interface: Attributes
Return the field attributes of the target field.

Specified by:
getAttributes in interface Attributes
Parameters:
targetField - the field that contains attribute information
Returns:
a Collection of attribute, possibly an empty Collection, never null

getAttributes

public java.util.Collection getAttributes(java.lang.reflect.Field targetField,
                                          java.lang.Class filter)
Description copied from interface: Attributes
Return the field attributes of the target method of a given type. The field attributes are filtered by providing a java.lang.Class reference to indicate the type to filter on. This is useful if you know the type of the attribute you are looking for and don't want to sort through the unfiltered Collection yourself.

Specified by:
getAttributes in interface Attributes
Parameters:
targetField - the field that contains attribute information
filter - specify that only this type of class should be returned
Returns:
a Collection of attributes, possibly an empty Collection, never null


Copyright (C) 2003-2004 The Spring Framework Project.