KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > metadata > Attributes


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.metadata;
18
19 import java.lang.reflect.Field JavaDoc;
20 import java.lang.reflect.Method JavaDoc;
21 import java.util.Collection JavaDoc;
22
23 /**
24  * Interface for accessing attributes at runtime. This is a facade,
25  * which can accommodate any attributes API such as Jakarta Commons Attributes,
26  * or (possibly in future) a Spring attributes implementation.
27  *
28  * <p>The purpose of using this interface is to decouple Spring code from any
29  * specific attributes implementation. Even once JSR-175 is available, there
30  * is still value in such a facade interface, as it allows for hierarchical
31  * attribute sources: for example, an XML file or properties file might override
32  * some attributes defined in source-level metadata with JSR-175 or another framework.
33  *
34  * @author Mark Pollack
35  * @author Rod Johnson
36  * @since 30.09.2003
37  * @see org.springframework.metadata.commons.CommonsAttributes
38  */

39 public interface Attributes {
40
41     /**
42      * Return the class attributes of the target class.
43      * @param targetClass the class that contains attribute information
44      * @return a collection of attributes, possibly an empty collection, never <code>null</code>
45      */

46     Collection JavaDoc getAttributes(Class JavaDoc targetClass);
47
48     /**
49      * Return the class attributes of the target class of a given type.
50      * <p>The class attributes are filtered by providing a <code>Class</code>
51      * reference to indicate the type to filter on. This is useful if you know
52      * the type of the attribute you are looking for and don't want to sort
53      * through the unfiltered Collection yourself.
54      * @param targetClass the class that contains attribute information
55      * @param filter specify that only this type of class should be returned
56      * @return return only the Collection of attributes that are of the filter type
57      */

58     Collection JavaDoc getAttributes(Class JavaDoc targetClass, Class JavaDoc filter);
59
60     /**
61      * Return the method attributes of the target method.
62      * @param targetMethod the method that contains attribute information
63      * @return a Collection of attributes, possibly an empty Collection, never <code>null</code>
64      */

65     Collection JavaDoc getAttributes(Method JavaDoc targetMethod);
66
67     /**
68      * Return the method attributes of the target method of a given type.
69      * <p>The method attributes are filtered by providing a <code>Class</code>
70      * reference to indicate the type to filter on. This is useful if you know
71      * the type of the attribute you are looking for and don't want to sort
72      * through the unfiltered Collection yourself.
73      * @param targetMethod the method that contains attribute information
74      * @param filter specify that only this type of class should be returned
75      * @return a Collection of attributes, possibly an empty Collection, never <code>null</code>
76      */

77     Collection JavaDoc getAttributes(Method JavaDoc targetMethod, Class JavaDoc filter);
78
79     /**
80      * Return the field attributes of the target field.
81      * @param targetField the field that contains attribute information
82      * @return a Collection of attribute, possibly an empty Collection, never <code>null</code>
83      */

84     Collection JavaDoc getAttributes(Field JavaDoc targetField);
85
86     /**
87      * Return the field attributes of the target method of a given type.
88      * <p>The field attributes are filtered by providing a <code>Class</code>
89      * reference to indicate the type to filter on. This is useful if you know
90      * the type of the attribute you are looking for and don't want to sort
91      * through the unfiltered Collection yourself.
92      * @param targetField the field that contains attribute information
93      * @param filter specify that only this type of class should be returned
94      * @return a Collection of attributes, possibly an empty Collection, never <code>null</code>
95      */

96     Collection JavaDoc getAttributes(Field JavaDoc targetField, Class JavaDoc filter);
97
98 }
99
Popular Tags