1 16 17 package org.springframework.beans.factory.wiring; 18 19 import org.springframework.beans.factory.config.AutowireCapableBeanFactory; 20 import org.springframework.util.Assert; 21 22 34 public class BeanWiringInfo { 35 36 41 public static final int AUTOWIRE_BY_NAME = AutowireCapableBeanFactory.AUTOWIRE_BY_NAME; 42 43 48 public static final int AUTOWIRE_BY_TYPE = AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; 49 50 51 private String beanName = null; 52 53 private int autowireMode = AutowireCapableBeanFactory.AUTOWIRE_NO; 54 55 private boolean dependencyCheck = false; 56 57 58 64 public BeanWiringInfo(String beanName) { 65 Assert.hasText(beanName, "'beanName' must not be empty"); 66 this.beanName = beanName; 67 } 68 69 80 public BeanWiringInfo(int autowireMode, boolean dependencyCheck) { 81 if (autowireMode != AUTOWIRE_BY_NAME && autowireMode != AUTOWIRE_BY_TYPE) { 82 throw new IllegalArgumentException ("Just constants AUTOWIRE_BY_NAME and AUTOWIRE_BY_TYPE allowed"); 83 } 84 this.autowireMode = autowireMode; 85 this.dependencyCheck = dependencyCheck; 86 } 87 88 89 92 public boolean indicatesAutowiring() { 93 return (this.beanName == null); 94 } 95 96 99 public String getBeanName() { 100 return this.beanName; 101 } 102 103 107 public int getAutowireMode() { 108 return this.autowireMode; 109 } 110 111 115 public boolean getDependencyCheck() { 116 return this.dependencyCheck; 117 } 118 119 } 120 | Popular Tags |