01: /*
02: * Copyright 2002-2006 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.beans.factory.parsing;
18:
19: import org.springframework.beans.factory.config.BeanDefinition;
20: import org.springframework.beans.factory.config.BeanReference;
21:
22: /**
23: * Base implementation of {@link ComponentDefinition} that provides a basic implementation of
24: * {@link #getDescription} which delegates to {@link #getName}. Also provides a base implementation
25: * of {@link #toString} which delegates to {@link #getDescription} in keeping with the recommended
26: * implementation strategy. Also provides default implementations of {@link #getInnerBeanDefinitions}
27: * and {@link #getBeanReferences} that return an empty array.
28: *
29: * @author Rob Harrop
30: * @author Juergen Hoeller
31: * @since 2.0
32: */
33: public abstract class AbstractComponentDefinition implements
34: ComponentDefinition {
35:
36: /**
37: * Delegates to {@link #getName}.
38: */
39: public String getDescription() {
40: return getName();
41: }
42:
43: /**
44: * Returns an empty array.
45: */
46: public BeanDefinition[] getBeanDefinitions() {
47: return new BeanDefinition[0];
48: }
49:
50: /**
51: * Returns an empty array.
52: */
53: public BeanDefinition[] getInnerBeanDefinitions() {
54: return new BeanDefinition[0];
55: }
56:
57: /**
58: * Returns an empty array.
59: */
60: public BeanReference[] getBeanReferences() {
61: return new BeanReference[0];
62: }
63:
64: /**
65: * Delegates to {@link #getDescription}.
66: */
67: public String toString() {
68: return getDescription();
69: }
70:
71: }
|