org.springframework.metadata
Interface Attributes

All Known Implementing Classes:
CommonsAttributes

public interface Attributes

Interface for accessing attributes at runtime. This is a facade, which can accommodate any attributes API such as Jakarta Commons Attributes, or (possibly in future) a Spring attributes implementation.

The purpose of using this interface is to decouple Spring code from any specific attributes implementation. Even once JSR-175 is available, there is still value in such a facade interface, as it allows for hierarchical attribute sources: for example, an XML file or properties file might override some attributes defined in source-level metadata with JSR-175 or another framework.

Since:
Sep 30, 2003
Author:
Mark Pollack, Rod Johnson

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.
 

Method Detail

getAttributes

public java.util.Collection getAttributes(java.lang.Class targetClass)
Return the class attributes of the target class.

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)
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.

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)
Return the method attributes of the target method.

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)
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.

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)
Return the field attributes of the target field.

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)
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.

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.