01: /*
02: * Copyright 2002-2005 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: /**
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
29: TransactionAttribute {
30:
31: private final TransactionAttribute targetAttribute;
32:
33: /**
34: * Create a DelegatingTransactionAttribute for the given target attribute.
35: * @param targetAttribute the target TransactionAttribute to delegate to
36: */
37: public DelegatingTransactionAttribute(
38: TransactionAttribute targetAttribute) {
39: this .targetAttribute = targetAttribute;
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 getName() {
59: return this .targetAttribute.getName();
60: }
61:
62: public boolean rollbackOn(Throwable ex) {
63: return this .targetAttribute.rollbackOn(ex);
64: }
65:
66: public boolean equals(Object obj) {
67: return this .targetAttribute.equals(obj);
68: }
69:
70: public int hashCode() {
71: return this .targetAttribute.hashCode();
72: }
73:
74: public String toString() {
75: return this.targetAttribute.toString();
76: }
77:
78: }
|