001/*
002 * Copyright 2002-2012 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.beans.factory.xml;
018
019import org.springframework.beans.factory.parsing.DefaultsDefinition;
020
021/**
022 * Simple JavaBean that holds the defaults specified at the {@code <beans>}
023 * level in a standard Spring XML bean definition document:
024 * {@code default-lazy-init}, {@code default-autowire}, etc.
025 *
026 * @author Juergen Hoeller
027 * @since 2.0.2
028 */
029public class DocumentDefaultsDefinition implements DefaultsDefinition {
030
031        private String lazyInit;
032
033        private String merge;
034
035        private String autowire;
036
037        private String dependencyCheck;
038
039        private String autowireCandidates;
040
041        private String initMethod;
042
043        private String destroyMethod;
044
045        private Object source;
046
047
048        /**
049         * Set the default lazy-init flag for the document that's currently parsed.
050         */
051        public void setLazyInit(String lazyInit) {
052                this.lazyInit = lazyInit;
053        }
054
055        /**
056         * Return the default lazy-init flag for the document that's currently parsed.
057         */
058        public String getLazyInit() {
059                return this.lazyInit;
060        }
061
062        /**
063         * Set the default merge setting for the document that's currently parsed.
064         */
065        public void setMerge(String merge) {
066                this.merge = merge;
067        }
068
069        /**
070         * Return the default merge setting for the document that's currently parsed.
071         */
072        public String getMerge() {
073                return this.merge;
074        }
075
076        /**
077         * Set the default autowire setting for the document that's currently parsed.
078         */
079        public void setAutowire(String autowire) {
080                this.autowire = autowire;
081        }
082
083        /**
084         * Return the default autowire setting for the document that's currently parsed.
085         */
086        public String getAutowire() {
087                return this.autowire;
088        }
089
090        /**
091         * Set the default dependency-check setting for the document that's currently parsed.
092         */
093        public void setDependencyCheck(String dependencyCheck) {
094                this.dependencyCheck = dependencyCheck;
095        }
096
097        /**
098         * Return the default dependency-check setting for the document that's currently parsed.
099         */
100        public String getDependencyCheck() {
101                return this.dependencyCheck;
102        }
103
104        /**
105         * Set the default autowire-candidate pattern for the document that's currently parsed.
106         * Also accepts a comma-separated list of patterns.
107         */
108        public void setAutowireCandidates(String autowireCandidates) {
109                this.autowireCandidates = autowireCandidates;
110        }
111
112        /**
113         * Return the default autowire-candidate pattern for the document that's currently parsed.
114         * May also return a comma-separated list of patterns.
115         */
116        public String getAutowireCandidates() {
117                return this.autowireCandidates;
118        }
119
120        /**
121         * Set the default init-method setting for the document that's currently parsed.
122         */
123        public void setInitMethod(String initMethod) {
124                this.initMethod = initMethod;
125        }
126
127        /**
128         * Return the default init-method setting for the document that's currently parsed.
129         */
130        public String getInitMethod() {
131                return this.initMethod;
132        }
133
134        /**
135         * Set the default destroy-method setting for the document that's currently parsed.
136         */
137        public void setDestroyMethod(String destroyMethod) {
138                this.destroyMethod = destroyMethod;
139        }
140
141        /**
142         * Return the default destroy-method setting for the document that's currently parsed.
143         */
144        public String getDestroyMethod() {
145                return this.destroyMethod;
146        }
147
148        /**
149         * Set the configuration source {@code Object} for this metadata element.
150         * <p>The exact type of the object will depend on the configuration mechanism used.
151         */
152        public void setSource(Object source) {
153                this.source = source;
154        }
155
156        @Override
157        public Object getSource() {
158                return this.source;
159        }
160
161}