KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > transaction > interceptor > DelegatingTransactionAttribute


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.transaction.interceptor;
18
19 /**
20  * TransactionAttribute implementation that delegates all calls to a given target
21  * TransactionAttribute. Abstract because it is meant to be subclassed,
22  * with subclasses overriding specific methods that should not simply delegate
23  * to the target.
24  *
25  * @author Juergen Hoeller
26  * @since 1.2
27  */

28 public abstract class DelegatingTransactionAttribute implements TransactionAttribute {
29
30     private final TransactionAttribute targetAttribute;
31
32
33     /**
34      * Create a DelegatingTransactionAttribute for the given target attribute.
35      * @param targetAttribute the target TransactionAttribute to delegate to
36      */

37     public DelegatingTransactionAttribute(TransactionAttribute targetAttribute) {
38         this.targetAttribute = targetAttribute;
39     }
40
41
42     public int getPropagationBehavior() {
43         return this.targetAttribute.getPropagationBehavior();
44     }
45
46     public int getIsolationLevel() {
47         return this.targetAttribute.getIsolationLevel();
48     }
49
50     public int getTimeout() {
51         return this.targetAttribute.getTimeout();
52     }
53
54     public boolean isReadOnly() {
55         return this.targetAttribute.isReadOnly();
56     }
57
58     public String JavaDoc getName() {
59         return this.targetAttribute.getName();
60     }
61
62     public boolean rollbackOn(Throwable JavaDoc ex) {
63         return this.targetAttribute.rollbackOn(ex);
64     }
65
66
67     public boolean equals(Object JavaDoc obj) {
68         return this.targetAttribute.equals(obj);
69     }
70
71     public int hashCode() {
72         return this.targetAttribute.hashCode();
73     }
74
75     public String JavaDoc toString() {
76         return this.targetAttribute.toString();
77     }
78
79 }
80
Popular Tags