Source Code Cross Referenced for ClassFilters.java in  » J2EE » spring-framework-2.5 » org » springframework » aop » support » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.aop.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.aop.support;
018:
019:        import java.io.Serializable;
020:
021:        import org.springframework.aop.ClassFilter;
022:        import org.springframework.util.Assert;
023:        import org.springframework.util.ObjectUtils;
024:
025:        /**
026:         * Static utility methods for composing
027:         * {@link org.springframework.aop.ClassFilter ClassFilters}.
028:         *
029:         * @author Rod Johnson
030:         * @author Rob Harrop
031:         * @author Juergen Hoeller
032:         * @since 11.11.2003
033:         * @see MethodMatchers
034:         * @see Pointcuts
035:         */
036:        public abstract class ClassFilters {
037:
038:            /**
039:             * Match all classes that <i>either</i> (or both) of the given ClassFilters matches.
040:             * @param cf1 the first ClassFilter
041:             * @param cf2 the second ClassFilter
042:             * @return a distinct ClassFilter that matches all classes that either
043:             * of the given ClassFilter matches
044:             */
045:            public static ClassFilter union(ClassFilter cf1, ClassFilter cf2) {
046:                Assert.notNull(cf1, "First ClassFilter must not be null");
047:                Assert.notNull(cf2, "Second ClassFilter must not be null");
048:                return new UnionClassFilter(new ClassFilter[] { cf1, cf2 });
049:            }
050:
051:            /**
052:             * Match all classes that <i>either</i> (or all) of the given ClassFilters matches.
053:             * @param classFilters the ClassFilters to match
054:             * @return a distinct ClassFilter that matches all classes that either
055:             * of the given ClassFilter matches
056:             */
057:            public static ClassFilter union(ClassFilter[] classFilters) {
058:                Assert.notEmpty(classFilters,
059:                        "ClassFilter array must not be empty");
060:                return new UnionClassFilter(classFilters);
061:            }
062:
063:            /**
064:             * Match all classes that <i>both</i> of the given ClassFilters match.
065:             * @param cf1 the first ClassFilter
066:             * @param cf2 the second ClassFilter
067:             * @return a distinct ClassFilter that matches all classes that both
068:             * of the given ClassFilter match
069:             */
070:            public static ClassFilter intersection(ClassFilter cf1,
071:                    ClassFilter cf2) {
072:                Assert.notNull(cf1, "First ClassFilter must not be null");
073:                Assert.notNull(cf2, "Second ClassFilter must not be null");
074:                return new IntersectionClassFilter(
075:                        new ClassFilter[] { cf1, cf2 });
076:            }
077:
078:            /**
079:             * Match all classes that <i>all</i> of the given ClassFilters match.
080:             * @param classFilters the ClassFilters to match
081:             * @return a distinct ClassFilter that matches all classes that both
082:             * of the given ClassFilter match
083:             */
084:            public static ClassFilter intersection(ClassFilter[] classFilters) {
085:                Assert.notEmpty(classFilters,
086:                        "ClassFilter array must not be empty");
087:                return new IntersectionClassFilter(classFilters);
088:            }
089:
090:            /**
091:             * ClassFilter implementation for a union of the given ClassFilters.
092:             */
093:            private static class UnionClassFilter implements  ClassFilter,
094:                    Serializable {
095:
096:                private ClassFilter[] filters;
097:
098:                public UnionClassFilter(ClassFilter[] filters) {
099:                    this .filters = filters;
100:                }
101:
102:                public boolean matches(Class clazz) {
103:                    for (int i = 0; i < this .filters.length; i++) {
104:                        if (this .filters[i].matches(clazz)) {
105:                            return true;
106:                        }
107:                    }
108:                    return false;
109:                }
110:
111:                public boolean equals(Object other) {
112:                    return (this  == other || (other instanceof  UnionClassFilter && ObjectUtils
113:                            .nullSafeEquals(this .filters,
114:                                    ((UnionClassFilter) other).filters)));
115:                }
116:
117:                public int hashCode() {
118:                    return ObjectUtils.nullSafeHashCode(this .filters);
119:                }
120:            }
121:
122:            /**
123:             * ClassFilter implementation for an intersection of the given ClassFilters.
124:             */
125:            private static class IntersectionClassFilter implements 
126:                    ClassFilter, Serializable {
127:
128:                private ClassFilter[] filters;
129:
130:                public IntersectionClassFilter(ClassFilter[] filters) {
131:                    this .filters = filters;
132:                }
133:
134:                public boolean matches(Class clazz) {
135:                    for (int i = 0; i < this .filters.length; i++) {
136:                        if (!this .filters[i].matches(clazz)) {
137:                            return false;
138:                        }
139:                    }
140:                    return true;
141:                }
142:
143:                public boolean equals(Object other) {
144:                    return (this  == other || (other instanceof  IntersectionClassFilter && ObjectUtils
145:                            .nullSafeEquals(this .filters,
146:                                    ((IntersectionClassFilter) other).filters)));
147:                }
148:
149:                public int hashCode() {
150:                    return ObjectUtils.nullSafeHashCode(this.filters);
151:                }
152:            }
153:
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.