org.springframework.metadata.commons
Class CommonsAttributes

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

public class CommonsAttributes
extends 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.

Author:
Rod Johnson

Constructor Summary
CommonsAttributes()
           
 
Method Summary
 Collection getAttributes(Class targetClass)
          Return the class attributes of the target class.
 Collection getAttributes(Class targetClass, Class filter)
          Return the class attributes of the target class of a given type.
 Collection getAttributes(Field targetField)
          Return the field attributes of the target field.
 Collection getAttributes(Field targetField, Class filter)
          Return the field attributes of the target method of a given type.
 Collection getAttributes(Method targetMethod)
          Return the method attributes of the target method.
 Collection getAttributes(Method targetMethod, 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 Collection getAttributes(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 Collection getAttributes(Class targetClass,
                                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 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 Collection getAttributes(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 Collection getAttributes(Method targetMethod,
                                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 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 Collection getAttributes(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 Collection getAttributes(Field targetField,
                                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 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) 2002-2006 The Spring Framework Project.