Formatting pass, primarily to align with Spring's convention of hard tab indentation.
This commit is contained in:
@@ -2,13 +2,14 @@ package test.basic;
|
||||
|
||||
import org.junit.Before;
|
||||
|
||||
|
||||
public abstract class AbstractJavaConfigTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
//protected
|
||||
|
||||
|
||||
// protected
|
||||
|
||||
}
|
||||
|
||||
@@ -13,49 +13,56 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import test.beans.Colour;
|
||||
import test.beans.TestBean;
|
||||
|
||||
|
||||
public class AutowiredConfigurationTests {
|
||||
public @Test void test() {
|
||||
public @Test
|
||||
void test() {
|
||||
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext(
|
||||
AutowiredConfigurationTests.class.getSimpleName() + ".xml",
|
||||
AutowiredConfigurationTests.class);
|
||||
|
||||
AutowiredConfigurationTests.class.getSimpleName() + ".xml", AutowiredConfigurationTests.class);
|
||||
|
||||
assertThat(factory.getBean("colour", Colour.class), equalTo(Colour.RED));
|
||||
assertThat(factory.getBean("testBean", TestBean.class).getName(), equalTo(Colour.RED.toString()));
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class AutowiredConfig {
|
||||
private @Autowired Colour colour;
|
||||
|
||||
public @Bean TestBean testBean() {
|
||||
private @Autowired
|
||||
Colour colour;
|
||||
|
||||
public @Bean
|
||||
TestBean testBean() {
|
||||
return new TestBean(colour.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class ColorConfig {
|
||||
public @Bean Colour colour() { return Colour.RED; }
|
||||
public @Bean
|
||||
Colour colour() {
|
||||
return Colour.RED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public @Test void testValueInjection() {
|
||||
|
||||
|
||||
public @Test
|
||||
void testValueInjection() {
|
||||
System.setProperty("myProp", "foo");
|
||||
|
||||
|
||||
ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext(
|
||||
"ValueInjectionTests.xml", AutowiredConfigurationTests.class);
|
||||
|
||||
"ValueInjectionTests.xml", AutowiredConfigurationTests.class);
|
||||
|
||||
TestBean testBean = factory.getBean("testBean", TestBean.class);
|
||||
assertThat(testBean.getName(), equalTo("foo"));
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class ValueConfig {
|
||||
|
||||
@Value("#{systemProperties.myProp}")
|
||||
|
||||
@Value("#{systemProperties.myProp}")
|
||||
private String name = "default";
|
||||
|
||||
public @Bean TestBean testBean() {
|
||||
|
||||
public @Bean
|
||||
TestBean testBean() {
|
||||
return new TestBean(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,82 +17,87 @@ import org.springframework.config.java.support.ConfigurationPostProcessor;
|
||||
import test.beans.ITestBean;
|
||||
import test.beans.TestBean;
|
||||
|
||||
|
||||
public class BasicTests {
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new {@link BeanFactory}, populates it with a {@link BeanDefinition} for
|
||||
* each of the given {@link Configuration} <var>configClasses</var>, and then post-processes
|
||||
* the factory using JavaConfig's {@link ConfigurationPostProcessor}. When complete,
|
||||
* the factory is ready to service requests for any {@link Bean} methods declared by
|
||||
* <var>configClasses</var>.
|
||||
* each of the given {@link Configuration} <var>configClasses</var>, and then
|
||||
* post-processes the factory using JavaConfig's {@link ConfigurationPostProcessor}.
|
||||
* When complete, the factory is ready to service requests for any {@link Bean} methods
|
||||
* declared by <var>configClasses</var>.
|
||||
*
|
||||
* @param configClasses the {@link Configuration} classes under test. may be an empty list.
|
||||
* @param configClasses the {@link Configuration} classes under test. may be an empty
|
||||
* list.
|
||||
*
|
||||
* @return fully initialized and post-processed {@link BeanFactory}
|
||||
*/
|
||||
private static BeanFactory initBeanFactory(Class<?>... configClasses) {
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
|
||||
for(Class<?> configClass : configClasses) {
|
||||
|
||||
for (Class<?> configClass : configClasses) {
|
||||
String configBeanName = configClass.getName();
|
||||
factory.registerBeanDefinition(configBeanName, rootBeanDefinition(configClass).getBeanDefinition());
|
||||
factory.registerBeanDefinition(configBeanName, rootBeanDefinition(configClass)
|
||||
.getBeanDefinition());
|
||||
}
|
||||
|
||||
|
||||
new ConfigurationPostProcessor().postProcessBeanFactory(factory);
|
||||
|
||||
|
||||
factory.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
|
||||
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void simplestPossibleConfiguration() {
|
||||
BeanFactory factory = initBeanFactory(SimplestPossibleConfig.class);
|
||||
|
||||
|
||||
String stringBean = factory.getBean("stringBean", String.class);
|
||||
|
||||
|
||||
assertThat(stringBean, equalTo("foo"));
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class SimplestPossibleConfig {
|
||||
public @Bean String stringBean() {
|
||||
public @Bean
|
||||
String stringBean() {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void configurationWithPrototypeScopedBeans() {
|
||||
BeanFactory factory = initBeanFactory(ConfigWithPrototypeBean.class);
|
||||
|
||||
|
||||
TestBean foo = factory.getBean("foo", TestBean.class);
|
||||
ITestBean bar = factory.getBean("bar", ITestBean.class);
|
||||
ITestBean baz = factory.getBean("baz", ITestBean.class);
|
||||
|
||||
|
||||
assertThat(foo.getSpouse(), sameInstance(bar));
|
||||
assertThat(bar.getSpouse(), not(sameInstance(baz)));
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
static class ConfigWithPrototypeBean {
|
||||
public @Bean TestBean foo() {
|
||||
public @Bean
|
||||
TestBean foo() {
|
||||
TestBean foo = new TestBean("foo");
|
||||
foo.setSpouse(bar());
|
||||
return foo;
|
||||
}
|
||||
|
||||
public @Bean TestBean bar() {
|
||||
|
||||
public @Bean
|
||||
TestBean bar() {
|
||||
TestBean bar = new TestBean("bar");
|
||||
bar.setSpouse(baz());
|
||||
return bar;
|
||||
}
|
||||
|
||||
@Bean(scope=Scopes.PROTOTYPE)
|
||||
|
||||
@Bean(scope = Scopes.PROTOTYPE)
|
||||
public TestBean baz() {
|
||||
return new TestBean("bar");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,19 +20,21 @@ import org.springframework.core.enums.ShortCodedLabeledEnum;
|
||||
|
||||
/**
|
||||
* TODO: JAVADOC
|
||||
*
|
||||
* @author Rob Harrop
|
||||
*
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class Colour extends ShortCodedLabeledEnum {
|
||||
|
||||
public static final Colour RED = new Colour(0, "RED");
|
||||
public static final Colour RED = new Colour(0, "RED");
|
||||
|
||||
public static final Colour BLUE = new Colour(1, "BLUE");
|
||||
public static final Colour BLUE = new Colour(1, "BLUE");
|
||||
|
||||
public static final Colour GREEN = new Colour(2, "GREEN");
|
||||
public static final Colour GREEN = new Colour(2, "GREEN");
|
||||
|
||||
public static final Colour PURPLE = new Colour(3, "PURPLE");
|
||||
public static final Colour PURPLE = new Colour(3, "PURPLE");
|
||||
|
||||
private Colour(int code, String label) { super(code, label); }
|
||||
private Colour(int code, String label) {
|
||||
super(code, label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,20 @@ package test.beans;
|
||||
|
||||
/** TODO: JAVADOC */
|
||||
public class DependsOnTestBean {
|
||||
public TestBean tb;
|
||||
public TestBean tb;
|
||||
|
||||
private int state;
|
||||
private int state;
|
||||
|
||||
public void setTestBean(TestBean tb) { this.tb = tb; }
|
||||
public void setTestBean(TestBean tb) {
|
||||
this.tb = tb;
|
||||
}
|
||||
|
||||
public int getState() { return state; }
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public TestBean getTestBean() { return tb; }
|
||||
public TestBean getTestBean() {
|
||||
return tb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ package test.beans;
|
||||
/** TODO: JAVADOC */
|
||||
public interface INestedTestBean {
|
||||
|
||||
String getCompany();
|
||||
String getCompany();
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ package test.beans;
|
||||
/** TODO: JAVADOC */
|
||||
public interface IOther {
|
||||
|
||||
void absquatulate();
|
||||
void absquatulate();
|
||||
|
||||
}
|
||||
|
||||
@@ -19,44 +19,44 @@ import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Interface used for test beans. Two methods are the same as on Person, but if
|
||||
* this extends person it breaks quite a few tests
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* Interface used for test beans. Two methods are the same as on Person, but if this extends
|
||||
* person it breaks quite a few tests
|
||||
*
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public interface ITestBean {
|
||||
|
||||
int getAge();
|
||||
int getAge();
|
||||
|
||||
void setAge(int age);
|
||||
void setAge(int age);
|
||||
|
||||
String getName();
|
||||
String getName();
|
||||
|
||||
void setName(String name);
|
||||
void setName(String name);
|
||||
|
||||
ITestBean getSpouse();
|
||||
ITestBean getSpouse();
|
||||
|
||||
void setSpouse(ITestBean spouse);
|
||||
void setSpouse(ITestBean spouse);
|
||||
|
||||
/**
|
||||
* t null no error.
|
||||
*/
|
||||
void exceptional(Throwable t) throws Throwable;
|
||||
/**
|
||||
* t null no error.
|
||||
*/
|
||||
void exceptional(Throwable t) throws Throwable;
|
||||
|
||||
Object returnsThis();
|
||||
Object returnsThis();
|
||||
|
||||
INestedTestBean getDoctor();
|
||||
INestedTestBean getDoctor();
|
||||
|
||||
INestedTestBean getLawyer();
|
||||
INestedTestBean getLawyer();
|
||||
|
||||
IndexedTestBean getNestedIndexedBean();
|
||||
IndexedTestBean getNestedIndexedBean();
|
||||
|
||||
/**
|
||||
* Increment the age by one.
|
||||
*
|
||||
* @return the previous age
|
||||
*/
|
||||
int haveBirthday();
|
||||
/**
|
||||
* Increment the age by one.
|
||||
*
|
||||
* @return the previous age
|
||||
*/
|
||||
int haveBirthday();
|
||||
|
||||
void unreliableFileOperation() throws IOException;
|
||||
void unreliableFileOperation() throws IOException;
|
||||
}
|
||||
|
||||
@@ -27,89 +27,119 @@ import java.util.TreeSet;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: JAVADOC
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 11.11.2003
|
||||
* TODO: JAVADOC
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 11.11.2003
|
||||
*/
|
||||
public class IndexedTestBean {
|
||||
|
||||
private TestBean[] array;
|
||||
private TestBean[] array;
|
||||
|
||||
private Collection<TestBean> collection;
|
||||
private Collection<TestBean> collection;
|
||||
|
||||
private List<TestBean> list;
|
||||
private List<TestBean> list;
|
||||
|
||||
private Set<TestBean> set;
|
||||
private Set<TestBean> set;
|
||||
|
||||
private SortedSet<TestBean> sortedSet;
|
||||
private SortedSet<TestBean> sortedSet;
|
||||
|
||||
private Map<String, Object> map;
|
||||
private Map<String, Object> map;
|
||||
|
||||
private SortedMap<String, TestBean> sortedMap;
|
||||
private SortedMap<String, TestBean> sortedMap;
|
||||
|
||||
public IndexedTestBean() { this(true); }
|
||||
public IndexedTestBean() {
|
||||
this(true);
|
||||
}
|
||||
|
||||
public IndexedTestBean(boolean populate) {
|
||||
if (populate) {
|
||||
populate();
|
||||
}
|
||||
}
|
||||
public IndexedTestBean(boolean populate) {
|
||||
if (populate) {
|
||||
populate();
|
||||
}
|
||||
}
|
||||
|
||||
public void populate() {
|
||||
TestBean tb0 = new TestBean("name0", 0);
|
||||
TestBean tb1 = new TestBean("name1", 0);
|
||||
TestBean tb2 = new TestBean("name2", 0);
|
||||
TestBean tb3 = new TestBean("name3", 0);
|
||||
TestBean tb4 = new TestBean("name4", 0);
|
||||
TestBean tb5 = new TestBean("name5", 0);
|
||||
TestBean tb6 = new TestBean("name6", 0);
|
||||
TestBean tb7 = new TestBean("name7", 0);
|
||||
TestBean tbX = new TestBean("nameX", 0);
|
||||
TestBean tbY = new TestBean("nameY", 0);
|
||||
this.array = new TestBean[] { tb0, tb1 };
|
||||
this.list = new ArrayList<TestBean>();
|
||||
this.list.add(tb2);
|
||||
this.list.add(tb3);
|
||||
this.set = new TreeSet<TestBean>();
|
||||
this.set.add(tb6);
|
||||
this.set.add(tb7);
|
||||
this.map = new HashMap<String, Object>();
|
||||
this.map.put("key1", tb4);
|
||||
this.map.put("key2", tb5);
|
||||
this.map.put("key.3", tb5);
|
||||
List<TestBean> list = new ArrayList<TestBean>();
|
||||
list.add(tbX);
|
||||
list.add(tbY);
|
||||
this.map.put("key4", list);
|
||||
}
|
||||
public void populate() {
|
||||
TestBean tb0 = new TestBean("name0", 0);
|
||||
TestBean tb1 = new TestBean("name1", 0);
|
||||
TestBean tb2 = new TestBean("name2", 0);
|
||||
TestBean tb3 = new TestBean("name3", 0);
|
||||
TestBean tb4 = new TestBean("name4", 0);
|
||||
TestBean tb5 = new TestBean("name5", 0);
|
||||
TestBean tb6 = new TestBean("name6", 0);
|
||||
TestBean tb7 = new TestBean("name7", 0);
|
||||
TestBean tbX = new TestBean("nameX", 0);
|
||||
TestBean tbY = new TestBean("nameY", 0);
|
||||
this.array = new TestBean[] { tb0, tb1 };
|
||||
this.list = new ArrayList<TestBean>();
|
||||
this.list.add(tb2);
|
||||
this.list.add(tb3);
|
||||
this.set = new TreeSet<TestBean>();
|
||||
this.set.add(tb6);
|
||||
this.set.add(tb7);
|
||||
this.map = new HashMap<String, Object>();
|
||||
this.map.put("key1", tb4);
|
||||
this.map.put("key2", tb5);
|
||||
this.map.put("key.3", tb5);
|
||||
List<TestBean> list = new ArrayList<TestBean>();
|
||||
list.add(tbX);
|
||||
list.add(tbY);
|
||||
this.map.put("key4", list);
|
||||
}
|
||||
|
||||
public TestBean[] getArray() { return array; }
|
||||
public TestBean[] getArray() {
|
||||
return array;
|
||||
}
|
||||
|
||||
public void setArray(TestBean[] array) { this.array = array; }
|
||||
public void setArray(TestBean[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
public Collection<?> getCollection() { return collection; }
|
||||
public Collection<?> getCollection() {
|
||||
return collection;
|
||||
}
|
||||
|
||||
public void setCollection(Collection<TestBean> collection) { this.collection = collection; }
|
||||
public void setCollection(Collection<TestBean> collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
public List<TestBean> getList() { return list; }
|
||||
public List<TestBean> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<TestBean> list) { this.list = list; }
|
||||
public void setList(List<TestBean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public Set<TestBean> getSet() { return set; }
|
||||
public Set<TestBean> getSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
public void setSet(Set<TestBean> set) { this.set = set; }
|
||||
public void setSet(Set<TestBean> set) {
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
public SortedSet<TestBean> getSortedSet() { return sortedSet; }
|
||||
public SortedSet<TestBean> getSortedSet() {
|
||||
return sortedSet;
|
||||
}
|
||||
|
||||
public void setSortedSet(SortedSet<TestBean> sortedSet) { this.sortedSet = sortedSet; }
|
||||
public void setSortedSet(SortedSet<TestBean> sortedSet) {
|
||||
this.sortedSet = sortedSet;
|
||||
}
|
||||
|
||||
public Map<String, Object> getMap() { return map; }
|
||||
public Map<String, Object> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map<String, Object> map) { this.map = map; }
|
||||
public void setMap(Map<String, Object> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public SortedMap<String, TestBean> getSortedMap() { return sortedMap; }
|
||||
public SortedMap<String, TestBean> getSortedMap() {
|
||||
return sortedMap;
|
||||
}
|
||||
|
||||
public void setSortedMap(SortedMap<String, TestBean> sortedMap) { this.sortedMap = sortedMap; }
|
||||
public void setSortedMap(SortedMap<String, TestBean> sortedMap) {
|
||||
this.sortedMap = sortedMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,46 +17,47 @@ package test.beans;
|
||||
|
||||
/**
|
||||
* Simple nested test bean used for testing bean factories, AOP framework etc.
|
||||
*
|
||||
* @author Trevor D. Cook
|
||||
* @since 30.09.2003
|
||||
*
|
||||
* @author Trevor D. Cook
|
||||
* @since 30.09.2003
|
||||
*/
|
||||
public class NestedTestBean implements INestedTestBean {
|
||||
|
||||
private String company = "";
|
||||
private String company = "";
|
||||
|
||||
public NestedTestBean() { }
|
||||
public NestedTestBean() {
|
||||
}
|
||||
|
||||
public NestedTestBean(String company) {
|
||||
setCompany(company);
|
||||
}
|
||||
public NestedTestBean(String company) {
|
||||
setCompany(company);
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
this.company = ((company != null) ? company : "");
|
||||
}
|
||||
public void setCompany(String company) {
|
||||
this.company = ((company != null) ? company : "");
|
||||
}
|
||||
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof NestedTestBean)) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof NestedTestBean)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NestedTestBean ntb = (NestedTestBean) obj;
|
||||
return this.company.equals(ntb.company);
|
||||
}
|
||||
NestedTestBean ntb = (NestedTestBean) obj;
|
||||
return this.company.equals(ntb.company);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.company.hashCode();
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.company.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NestedTestBean: " + this.company;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NestedTestBean: " + this.company;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,259 +37,383 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* Simple test bean used for testing bean factories, AOP framework etc.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 15 April 2001
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 15 April 2001
|
||||
*/
|
||||
public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable<Object> {
|
||||
|
||||
private String beanName;
|
||||
private String beanName;
|
||||
|
||||
private String country;
|
||||
private String country;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
private boolean postProcessed;
|
||||
private boolean postProcessed;
|
||||
|
||||
private String name;
|
||||
private String name;
|
||||
|
||||
private String sex;
|
||||
private String sex;
|
||||
|
||||
private int age;
|
||||
private int age;
|
||||
|
||||
private boolean jedi;
|
||||
private boolean jedi;
|
||||
|
||||
private ITestBean spouse;
|
||||
private ITestBean spouse;
|
||||
|
||||
private String touchy;
|
||||
private String touchy;
|
||||
|
||||
private String[] stringArray;
|
||||
private String[] stringArray;
|
||||
|
||||
private Integer[] someIntegerArray;
|
||||
private Integer[] someIntegerArray;
|
||||
|
||||
private Date date = new Date();
|
||||
private Date date = new Date();
|
||||
|
||||
private Float myFloat = new Float(0.0);
|
||||
private Float myFloat = new Float(0.0);
|
||||
|
||||
private Collection<?> friends = new LinkedList<Object>();
|
||||
private Collection<?> friends = new LinkedList<Object>();
|
||||
|
||||
private Set<?> someSet = new HashSet<Object>();
|
||||
private Set<?> someSet = new HashSet<Object>();
|
||||
|
||||
private Map<?, ?> someMap = new HashMap<Object, Object>();
|
||||
private Map<?, ?> someMap = new HashMap<Object, Object>();
|
||||
|
||||
private List<?> someList = new ArrayList<Object>();
|
||||
private List<?> someList = new ArrayList<Object>();
|
||||
|
||||
private Properties someProperties = new Properties();
|
||||
private Properties someProperties = new Properties();
|
||||
|
||||
private INestedTestBean doctor = new NestedTestBean();
|
||||
private INestedTestBean doctor = new NestedTestBean();
|
||||
|
||||
private INestedTestBean lawyer = new NestedTestBean();
|
||||
private INestedTestBean lawyer = new NestedTestBean();
|
||||
|
||||
private IndexedTestBean nestedIndexedBean;
|
||||
private IndexedTestBean nestedIndexedBean;
|
||||
|
||||
private boolean destroyed;
|
||||
private boolean destroyed;
|
||||
|
||||
private Number someNumber;
|
||||
private Number someNumber;
|
||||
|
||||
private Colour favouriteColour;
|
||||
private Colour favouriteColour;
|
||||
|
||||
private Boolean someBoolean;
|
||||
private Boolean someBoolean;
|
||||
|
||||
private List<?> otherColours;
|
||||
private List<?> otherColours;
|
||||
|
||||
private List<?> pets;
|
||||
private List<?> pets;
|
||||
|
||||
public TestBean() { }
|
||||
public TestBean() {
|
||||
}
|
||||
|
||||
public TestBean(String name) { this.name = name; }
|
||||
public TestBean(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public TestBean(ITestBean spouse) { this.spouse = spouse; }
|
||||
public TestBean(ITestBean spouse) {
|
||||
this.spouse = spouse;
|
||||
}
|
||||
|
||||
public TestBean(String name, int age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
public TestBean(String name, int age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public TestBean(ITestBean spouse, Properties someProperties) {
|
||||
this.spouse = spouse;
|
||||
this.someProperties = someProperties;
|
||||
}
|
||||
public TestBean(ITestBean spouse, Properties someProperties) {
|
||||
this.spouse = spouse;
|
||||
this.someProperties = someProperties;
|
||||
}
|
||||
|
||||
public void setBeanName(String beanName) { this.beanName = beanName; }
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
public String getBeanName() { return beanName; }
|
||||
public String getBeanName() {
|
||||
return beanName;
|
||||
}
|
||||
|
||||
public void setBeanFactory(BeanFactory beanFactory) { this.beanFactory = beanFactory; }
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
public BeanFactory getBeanFactory() { return beanFactory; }
|
||||
public BeanFactory getBeanFactory() {
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
public void setPostProcessed(boolean postProcessed) { this.postProcessed = postProcessed; }
|
||||
public void setPostProcessed(boolean postProcessed) {
|
||||
this.postProcessed = postProcessed;
|
||||
}
|
||||
|
||||
public boolean isPostProcessed() { return postProcessed; }
|
||||
public boolean isPostProcessed() {
|
||||
return postProcessed;
|
||||
}
|
||||
|
||||
public String getName() { return name; }
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) { this.name = name; }
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSex() { return sex; }
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex) { this.sex = sex; }
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public int getAge() { return age; }
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) { this.age = age; }
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public boolean isJedi() { return jedi; }
|
||||
public boolean isJedi() {
|
||||
return jedi;
|
||||
}
|
||||
|
||||
public void setJedi(boolean jedi) { this.jedi = jedi; }
|
||||
public void setJedi(boolean jedi) {
|
||||
this.jedi = jedi;
|
||||
}
|
||||
|
||||
public ITestBean getSpouse() { return spouse; }
|
||||
public ITestBean getSpouse() {
|
||||
return spouse;
|
||||
}
|
||||
|
||||
public void setSpouse(ITestBean spouse) { this.spouse = spouse; }
|
||||
public void setSpouse(ITestBean spouse) {
|
||||
this.spouse = spouse;
|
||||
}
|
||||
|
||||
public String getTouchy() { return touchy; }
|
||||
public String getTouchy() {
|
||||
return touchy;
|
||||
}
|
||||
|
||||
public void setTouchy(String touchy) throws Exception {
|
||||
if (touchy.indexOf('.') != -1) {
|
||||
throw new Exception("Can't contain a .");
|
||||
}
|
||||
public void setTouchy(String touchy) throws Exception {
|
||||
if (touchy.indexOf('.') != -1) {
|
||||
throw new Exception("Can't contain a .");
|
||||
}
|
||||
|
||||
if (touchy.indexOf(',') != -1) {
|
||||
throw new NumberFormatException("Number format exception: contains a ,");
|
||||
}
|
||||
if (touchy.indexOf(',') != -1) {
|
||||
throw new NumberFormatException("Number format exception: contains a ,");
|
||||
}
|
||||
|
||||
this.touchy = touchy;
|
||||
}
|
||||
this.touchy = touchy;
|
||||
}
|
||||
|
||||
public String getCountry() { return country; }
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) { this.country = country; }
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String[] getStringArray() { return stringArray; }
|
||||
public String[] getStringArray() {
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
public void setStringArray(String[] stringArray) { this.stringArray = stringArray; }
|
||||
public void setStringArray(String[] stringArray) {
|
||||
this.stringArray = stringArray;
|
||||
}
|
||||
|
||||
public Integer[] getSomeIntegerArray() { return someIntegerArray; }
|
||||
public Integer[] getSomeIntegerArray() {
|
||||
return someIntegerArray;
|
||||
}
|
||||
|
||||
public void setSomeIntegerArray(Integer[] someIntegerArray) { this.someIntegerArray = someIntegerArray; }
|
||||
public void setSomeIntegerArray(Integer[] someIntegerArray) {
|
||||
this.someIntegerArray = someIntegerArray;
|
||||
}
|
||||
|
||||
public Date getDate() { return date; }
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) { this.date = date; }
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Float getMyFloat() { return myFloat; }
|
||||
public Float getMyFloat() {
|
||||
return myFloat;
|
||||
}
|
||||
|
||||
public void setMyFloat(Float myFloat) { this.myFloat = myFloat; }
|
||||
public void setMyFloat(Float myFloat) {
|
||||
this.myFloat = myFloat;
|
||||
}
|
||||
|
||||
public Collection<?> getFriends() { return friends; }
|
||||
public Collection<?> getFriends() {
|
||||
return friends;
|
||||
}
|
||||
|
||||
public void setFriends(Collection<?> friends) { this.friends = friends; }
|
||||
public void setFriends(Collection<?> friends) {
|
||||
this.friends = friends;
|
||||
}
|
||||
|
||||
public Set<?> getSomeSet() { return someSet; }
|
||||
|
||||
public void setSomeSet(Set<?> someSet) { this.someSet = someSet; }
|
||||
|
||||
public Map<?, ?> getSomeMap() { return someMap; }
|
||||
|
||||
public void setSomeMap(Map<?, ?> someMap) { this.someMap = someMap; }
|
||||
|
||||
public List<?> getSomeList() { return someList; }
|
||||
|
||||
public void setSomeList(List<?> someList) { this.someList = someList; }
|
||||
|
||||
public Properties getSomeProperties() { return someProperties; }
|
||||
|
||||
public void setSomeProperties(Properties someProperties) { this.someProperties = someProperties; }
|
||||
|
||||
public INestedTestBean getDoctor() { return doctor; }
|
||||
|
||||
public INestedTestBean getLawyer() { return lawyer; }
|
||||
|
||||
public void setDoctor(INestedTestBean bean) { doctor = bean; }
|
||||
|
||||
public void setLawyer(INestedTestBean bean) { lawyer = bean; }
|
||||
|
||||
public Number getSomeNumber() { return someNumber; }
|
||||
|
||||
public void setSomeNumber(Number someNumber) { this.someNumber = someNumber; }
|
||||
|
||||
public Colour getFavouriteColour() { return favouriteColour; }
|
||||
|
||||
public void setFavouriteColour(Colour favouriteColour) { this.favouriteColour = favouriteColour; }
|
||||
|
||||
public Boolean getSomeBoolean() { return someBoolean; }
|
||||
|
||||
public void setSomeBoolean(Boolean someBoolean) { this.someBoolean = someBoolean; }
|
||||
|
||||
public IndexedTestBean getNestedIndexedBean() { return nestedIndexedBean; }
|
||||
|
||||
public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { this.nestedIndexedBean = nestedIndexedBean; }
|
||||
|
||||
public List<?> getOtherColours() { return otherColours; }
|
||||
|
||||
public void setOtherColours(List<?> otherColours) { this.otherColours = otherColours; }
|
||||
|
||||
public List<?> getPets() { return pets; }
|
||||
|
||||
public void setPets(List<?> pets) { this.pets = pets; }
|
||||
|
||||
/**
|
||||
* @see ITestBean#exceptional(Throwable)
|
||||
*/
|
||||
public void exceptional(Throwable t) throws Throwable {
|
||||
if (t != null) {
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
||||
public void unreliableFileOperation() throws IOException { throw new IOException(); }
|
||||
|
||||
/**
|
||||
* @see ITestBean#returnsThis()
|
||||
*/
|
||||
public Object returnsThis() { return this; }
|
||||
|
||||
/**
|
||||
* @see IOther#absquatulate()
|
||||
*/
|
||||
public void absquatulate() { }
|
||||
|
||||
public int haveBirthday() { return age++; }
|
||||
|
||||
public void destroy() { this.destroyed = true; }
|
||||
|
||||
public boolean wasDestroyed() { return destroyed; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((other == null) || !(other instanceof TestBean)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TestBean tb2 = (TestBean) other;
|
||||
return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && (this.age == tb2.age));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return this.age; }
|
||||
|
||||
public int compareTo(Object other) {
|
||||
if ((this.name != null) && (other instanceof TestBean)) {
|
||||
return this.name.compareTo(((TestBean) other).getName());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = "name=" + name + "; age=" + age + "; touchy=" + touchy;
|
||||
s += "; spouse={" + ((spouse != null) ? spouse.getName() : null) + "}";
|
||||
return s;
|
||||
}
|
||||
public Set<?> getSomeSet() {
|
||||
return someSet;
|
||||
}
|
||||
|
||||
public void setSomeSet(Set<?> someSet) {
|
||||
this.someSet = someSet;
|
||||
}
|
||||
|
||||
public Map<?, ?> getSomeMap() {
|
||||
return someMap;
|
||||
}
|
||||
|
||||
public void setSomeMap(Map<?, ?> someMap) {
|
||||
this.someMap = someMap;
|
||||
}
|
||||
|
||||
public List<?> getSomeList() {
|
||||
return someList;
|
||||
}
|
||||
|
||||
public void setSomeList(List<?> someList) {
|
||||
this.someList = someList;
|
||||
}
|
||||
|
||||
public Properties getSomeProperties() {
|
||||
return someProperties;
|
||||
}
|
||||
|
||||
public void setSomeProperties(Properties someProperties) {
|
||||
this.someProperties = someProperties;
|
||||
}
|
||||
|
||||
public INestedTestBean getDoctor() {
|
||||
return doctor;
|
||||
}
|
||||
|
||||
public INestedTestBean getLawyer() {
|
||||
return lawyer;
|
||||
}
|
||||
|
||||
public void setDoctor(INestedTestBean bean) {
|
||||
doctor = bean;
|
||||
}
|
||||
|
||||
public void setLawyer(INestedTestBean bean) {
|
||||
lawyer = bean;
|
||||
}
|
||||
|
||||
public Number getSomeNumber() {
|
||||
return someNumber;
|
||||
}
|
||||
|
||||
public void setSomeNumber(Number someNumber) {
|
||||
this.someNumber = someNumber;
|
||||
}
|
||||
|
||||
public Colour getFavouriteColour() {
|
||||
return favouriteColour;
|
||||
}
|
||||
|
||||
public void setFavouriteColour(Colour favouriteColour) {
|
||||
this.favouriteColour = favouriteColour;
|
||||
}
|
||||
|
||||
public Boolean getSomeBoolean() {
|
||||
return someBoolean;
|
||||
}
|
||||
|
||||
public void setSomeBoolean(Boolean someBoolean) {
|
||||
this.someBoolean = someBoolean;
|
||||
}
|
||||
|
||||
public IndexedTestBean getNestedIndexedBean() {
|
||||
return nestedIndexedBean;
|
||||
}
|
||||
|
||||
public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) {
|
||||
this.nestedIndexedBean = nestedIndexedBean;
|
||||
}
|
||||
|
||||
public List<?> getOtherColours() {
|
||||
return otherColours;
|
||||
}
|
||||
|
||||
public void setOtherColours(List<?> otherColours) {
|
||||
this.otherColours = otherColours;
|
||||
}
|
||||
|
||||
public List<?> getPets() {
|
||||
return pets;
|
||||
}
|
||||
|
||||
public void setPets(List<?> pets) {
|
||||
this.pets = pets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ITestBean#exceptional(Throwable)
|
||||
*/
|
||||
public void exceptional(Throwable t) throws Throwable {
|
||||
if (t != null) {
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
||||
public void unreliableFileOperation() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ITestBean#returnsThis()
|
||||
*/
|
||||
public Object returnsThis() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IOther#absquatulate()
|
||||
*/
|
||||
public void absquatulate() {
|
||||
}
|
||||
|
||||
public int haveBirthday() {
|
||||
return age++;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
this.destroyed = true;
|
||||
}
|
||||
|
||||
public boolean wasDestroyed() {
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((other == null) || !(other instanceof TestBean)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TestBean tb2 = (TestBean) other;
|
||||
return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && (this.age == tb2.age));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.age;
|
||||
}
|
||||
|
||||
public int compareTo(Object other) {
|
||||
if ((this.name != null) && (other instanceof TestBean)) {
|
||||
return this.name.compareTo(((TestBean) other).getName());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = "name=" + name + "; age=" + age + "; touchy=" + touchy;
|
||||
s += "; spouse={" + ((spouse != null) ? spouse.getName() : null) + "}";
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user