001/* 002 * Copyright 2002-2017 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; 020import org.springframework.lang.Nullable; 021 022/** 023 * Simple JavaBean that holds the defaults specified at the {@code <beans>} 024 * level in a standard Spring XML bean definition document: 025 * {@code default-lazy-init}, {@code default-autowire}, etc. 026 * 027 * @author Juergen Hoeller 028 * @since 2.0.2 029 */ 030public class DocumentDefaultsDefinition implements DefaultsDefinition { 031 032 @Nullable 033 private String lazyInit; 034 035 @Nullable 036 private String merge; 037 038 @Nullable 039 private String autowire; 040 041 @Nullable 042 private String autowireCandidates; 043 044 @Nullable 045 private String initMethod; 046 047 @Nullable 048 private String destroyMethod; 049 050 @Nullable 051 private Object source; 052 053 054 /** 055 * Set the default lazy-init flag for the document that's currently parsed. 056 */ 057 public void setLazyInit(@Nullable String lazyInit) { 058 this.lazyInit = lazyInit; 059 } 060 061 /** 062 * Return the default lazy-init flag for the document that's currently parsed. 063 */ 064 @Nullable 065 public String getLazyInit() { 066 return this.lazyInit; 067 } 068 069 /** 070 * Set the default merge setting for the document that's currently parsed. 071 */ 072 public void setMerge(@Nullable String merge) { 073 this.merge = merge; 074 } 075 076 /** 077 * Return the default merge setting for the document that's currently parsed. 078 */ 079 @Nullable 080 public String getMerge() { 081 return this.merge; 082 } 083 084 /** 085 * Set the default autowire setting for the document that's currently parsed. 086 */ 087 public void setAutowire(@Nullable String autowire) { 088 this.autowire = autowire; 089 } 090 091 /** 092 * Return the default autowire setting for the document that's currently parsed. 093 */ 094 @Nullable 095 public String getAutowire() { 096 return this.autowire; 097 } 098 099 /** 100 * Set the default autowire-candidate pattern for the document that's currently parsed. 101 * Also accepts a comma-separated list of patterns. 102 */ 103 public void setAutowireCandidates(@Nullable String autowireCandidates) { 104 this.autowireCandidates = autowireCandidates; 105 } 106 107 /** 108 * Return the default autowire-candidate pattern for the document that's currently parsed. 109 * May also return a comma-separated list of patterns. 110 */ 111 @Nullable 112 public String getAutowireCandidates() { 113 return this.autowireCandidates; 114 } 115 116 /** 117 * Set the default init-method setting for the document that's currently parsed. 118 */ 119 public void setInitMethod(@Nullable String initMethod) { 120 this.initMethod = initMethod; 121 } 122 123 /** 124 * Return the default init-method setting for the document that's currently parsed. 125 */ 126 @Nullable 127 public String getInitMethod() { 128 return this.initMethod; 129 } 130 131 /** 132 * Set the default destroy-method setting for the document that's currently parsed. 133 */ 134 public void setDestroyMethod(@Nullable String destroyMethod) { 135 this.destroyMethod = destroyMethod; 136 } 137 138 /** 139 * Return the default destroy-method setting for the document that's currently parsed. 140 */ 141 @Nullable 142 public String getDestroyMethod() { 143 return this.destroyMethod; 144 } 145 146 /** 147 * Set the configuration source {@code Object} for this metadata element. 148 * <p>The exact type of the object will depend on the configuration mechanism used. 149 */ 150 public void setSource(@Nullable Object source) { 151 this.source = source; 152 } 153 154 @Override 155 @Nullable 156 public Object getSource() { 157 return this.source; 158 } 159 160}