View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2009 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.util.metadata;
18  
19  import java.lang.reflect.Field;
20  import java.lang.reflect.Method;
21  import java.util.Collection;
22  
23  /**
24   * This Interface has been copied to the EL4J Framework from Spring 2.5.
25   * The reason is that it is needed by more than one EL4J core class and
26   * no longer integrated inside the Spring 3.0 libraries. 
27   * 
28   * Interface for accessing attributes at runtime. This is a facade,
29   * which can accommodate any attributes API such as Jakarta Commons Attributes,
30   * or (possibly in future) a Spring attributes implementation.
31   *
32   * @svnLink $Revision: 4091 $;$Date: 2010-01-15 12:21:07 +0100 (Fr, 15. Jan 2010) $;$Author: jonasha $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/core/src/main/java/ch/elca/el4j/util/metadata/Attributes.java $
33   * 
34   * @author Mark Pollack
35   * @author Rod Johnson
36   * @author Jonas Hauenstein (JHN)
37   * @since 2.0
38   */
39  public interface Attributes {
40  	/**
41  	 * Return the class attributes of the target class.
42  	 * @param targetClass the class that contains attribute information
43  	 * @return a collection of attributes, possibly an empty collection, never <code>null</code>
44  	 */
45  	Collection getAttributes(Class targetClass);
46  
47  	/**
48  	 * Return the class attributes of the target class of a given type.
49  	 * <p>The class attributes are filtered by providing a <code>Class</code>
50  	 * reference to indicate the type to filter on. This is useful if you know
51  	 * the type of the attribute you are looking for and don't want to sort
52  	 * through the unfiltered Collection yourself.
53  	 * @param targetClass the class that contains attribute information
54  	 * @param filter specify that only this type of class should be returned
55  	 * @return return only the Collection of attributes that are of the filter type
56  	 */
57  	Collection getAttributes(Class targetClass, Class filter);
58  
59  	/**
60  	 * Return the method attributes of the target method.
61  	 * @param targetMethod the method that contains attribute information
62  	 * @return a Collection of attributes, possibly an empty Collection, never <code>null</code>
63  	 */
64  	Collection getAttributes(Method targetMethod);
65  
66  	/**
67  	 * Return the method attributes of the target method of a given type.
68  	 * <p>The method attributes are filtered by providing a <code>Class</code>
69  	 * reference to indicate the type to filter on. This is useful if you know
70  	 * the type of the attribute you are looking for and don't want to sort
71  	 * through the unfiltered Collection yourself.
72  	 * @param targetMethod the method that contains attribute information
73  	 * @param filter specify that only this type of class should be returned
74  	 * @return a Collection of attributes, possibly an empty Collection, never <code>null</code>
75  	 */
76  	Collection getAttributes(Method targetMethod, Class filter);
77  
78  	/**
79  	 * Return the field attributes of the target field.
80  	 * @param targetField the field that contains attribute information
81  	 * @return a Collection of attribute, possibly an empty Collection, never <code>null</code>
82  	 */
83  	Collection getAttributes(Field targetField);
84  
85  	/**
86  	 * Return the field attributes of the target method of a given type.
87  	 * <p>The field attributes are filtered by providing a <code>Class</code>
88  	 * reference to indicate the type to filter on. This is useful if you know
89  	 * the type of the attribute you are looking for and don't want to sort
90  	 * through the unfiltered Collection yourself.
91  	 * @param targetField the field that contains attribute information
92  	 * @param filter specify that only this type of class should be returned
93  	 * @return a Collection of attributes, possibly an empty Collection, never <code>null</code>
94  	 */
95  	Collection getAttributes(Field targetField, Class filter);
96  }