KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > aop > framework > CountingMultiAdvice


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.aop.framework;
18
19 import java.lang.reflect.Method JavaDoc;
20
21 import javax.servlet.ServletException JavaDoc;
22
23 import org.springframework.aop.AfterReturningAdvice;
24 import org.springframework.aop.MethodBeforeAdvice;
25 import org.springframework.aop.ThrowsAdvice;
26 import org.springframework.dao.DataAccessException;
27
28 /**
29  * Advice object that implements <i>multiple</i> Advice interfaces.
30  *
31  * @author Juergen Hoeller
32  * @since 19.05.2005
33  */

34 public class CountingMultiAdvice extends MethodCounter
35         implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice {
36
37     public void before(Method JavaDoc m, Object JavaDoc[] args, Object JavaDoc target) throws Throwable JavaDoc {
38         count(m);
39     }
40
41     public void afterReturning(Object JavaDoc o, Method JavaDoc m, Object JavaDoc[] args, Object JavaDoc target) throws Throwable JavaDoc {
42         count(m);
43     }
44
45     public void afterThrowing(ServletException JavaDoc sex) throws Throwable JavaDoc {
46         count(ServletException JavaDoc.class.getName());
47     }
48
49     public void afterThrowing(DataAccessException ex) throws Throwable JavaDoc {
50         count(DataAccessException.class.getName());
51     }
52
53 }
54
Popular Tags