KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > metadata > commons > CommonsAttributes


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.commons;
18
19 import java.lang.reflect.Field JavaDoc;
20 import java.lang.reflect.Method JavaDoc;
21 import java.util.Collection JavaDoc;
22
23 import org.springframework.metadata.Attributes;
24
25 /**
26  * Implementation of the Spring Attributes facade for Commons Attributes.
27  *
28  * <p>Please see the
29  * <a HREF="http://jakarta.apache.org/commons/sandbox/attributes">
30  * Commons Attributes documentation</a> for information on how to use the
31  * attribute compiler.
32  *
33  * <p>As of December 2003, follow the Javadocs to the AttributeCompiler class
34  * to see how the Ant task works. Note that you need to put the following jars
35  * in your $ANT_HOME/lib directory for the Common Attributes compiler to work:
36  * <ul>
37  * <li>Commons Attributes compiler jar
38  * <li>the xjavadoc Jar (from XDoclet)
39  * <li>commons-collection.jar (from Jakarta Commons)
40  * </ul>
41  *
42  * <p>You need to perform the attribute compilation step before compiling your source.
43  *
44  * <p>See build.xml in the tests for package org.springframework.aop.autoproxy.metadata
45  * for an example of the required Ant scripting. The header of this build script
46  * includes some quick, and hopefully useful, hints on using Commons Attributes.
47  * The source files in the same package (TxClass and TxClassWithClassAttribute)
48  * illustrate attribute usage in source files.
49  *
50  * <p>The Spring Framework project does not provide support usage of specific
51  * attributes implementations. Please refer to the appropriate site and mailing
52  * list of the attributes implementation.
53  *
54  * @author Rod Johnson
55  */

56 public class CommonsAttributes implements Attributes {
57     
58     /*
59      * Commons Attributes caches attributes, so we don't need to cache here
60      * as well.
61      */

62
63     public Collection JavaDoc getAttributes(Class JavaDoc targetClass) {
64         return org.apache.commons.attributes.Attributes.getAttributes(targetClass);
65     }
66
67     public Collection JavaDoc getAttributes(Class JavaDoc targetClass, Class JavaDoc filter) {
68         return org.apache.commons.attributes.Attributes.getAttributes(targetClass, filter);
69     }
70
71     public Collection JavaDoc getAttributes(Method JavaDoc targetMethod) {
72         return org.apache.commons.attributes.Attributes.getAttributes(targetMethod);
73     }
74
75     public Collection JavaDoc getAttributes(Method JavaDoc targetMethod, Class JavaDoc filter) {
76         return org.apache.commons.attributes.Attributes.getAttributes(targetMethod, filter);
77     }
78
79     public Collection JavaDoc getAttributes(Field JavaDoc targetField) {
80         return org.apache.commons.attributes.Attributes.getAttributes(targetField);
81     }
82
83     public Collection JavaDoc getAttributes(Field JavaDoc targetField, Class JavaDoc filter) {
84         return org.apache.commons.attributes.Attributes.getAttributes(targetField, filter);
85     }
86
87 }
88
Popular Tags