01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: import java.io.Serializable;
20:
21: /**
22: * TransactionAttribute implementation that delegates all calls to a given target
23: * TransactionAttribute. Abstract because it is meant to be subclassed,
24: * with subclasses overriding specific methods that should not simply delegate
25: * to the target.
26: *
27: * @author Juergen Hoeller
28: * @since 1.2
29: */
30: public abstract class DelegatingTransactionAttribute implements
31: TransactionAttribute, Serializable {
32:
33: private final TransactionAttribute targetAttribute;
34:
35: /**
36: * Create a DelegatingTransactionAttribute for the given target attribute.
37: * @param targetAttribute the target TransactionAttribute to delegate to
38: */
39: public DelegatingTransactionAttribute(
40: TransactionAttribute targetAttribute) {
41: this .targetAttribute = targetAttribute;
42: }
43:
44: public int getPropagationBehavior() {
45: return this .targetAttribute.getPropagationBehavior();
46: }
47:
48: public int getIsolationLevel() {
49: return this .targetAttribute.getIsolationLevel();
50: }
51:
52: public int getTimeout() {
53: return this .targetAttribute.getTimeout();
54: }
55:
56: public boolean isReadOnly() {
57: return this .targetAttribute.isReadOnly();
58: }
59:
60: public String getName() {
61: return this .targetAttribute.getName();
62: }
63:
64: public boolean rollbackOn(Throwable ex) {
65: return this .targetAttribute.rollbackOn(ex);
66: }
67:
68: public boolean equals(Object obj) {
69: return this .targetAttribute.equals(obj);
70: }
71:
72: public int hashCode() {
73: return this .targetAttribute.hashCode();
74: }
75:
76: public String toString() {
77: return this.targetAttribute.toString();
78: }
79:
80: }
|