Java Code Examples for org.springframework.tests.sample.beans.GenericBean#setListOfArrays()

The following examples show how to use org.springframework.tests.sample.beans.GenericBean#setListOfArrays() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeanWrapperGenericsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGenericListOfArrays() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	ArrayList<String[]> list = new ArrayList<>();
	list.add(new String[] {"str1", "str2"});
	gb.setListOfArrays(list);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
	assertEquals("str3 ", bw.getPropertyValue("listOfArrays[0][1]"));
	assertEquals("str3 ", gb.getListOfArrays().get(0)[1]);
}
 
Example 2
Source File: BeanWrapperGenericsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGenericListOfArraysWithElementConversion() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	ArrayList<String[]> list = new ArrayList<>();
	list.add(new String[] {"str1", "str2"});
	gb.setListOfArrays(list);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.registerCustomEditor(String.class, new StringTrimmerEditor(false));
	bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
	assertEquals("str3", bw.getPropertyValue("listOfArrays[0][1]"));
	assertEquals("str3", gb.getListOfArrays().get(0)[1]);
}
 
Example 3
Source File: BeanWrapperGenericsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGenericListOfArrays() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	ArrayList<String[]> list = new ArrayList<>();
	list.add(new String[] {"str1", "str2"});
	gb.setListOfArrays(list);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
	assertEquals("str3 ", bw.getPropertyValue("listOfArrays[0][1]"));
	assertEquals("str3 ", gb.getListOfArrays().get(0)[1]);
}
 
Example 4
Source File: BeanWrapperGenericsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGenericListOfArraysWithElementConversion() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<>();
	ArrayList<String[]> list = new ArrayList<>();
	list.add(new String[] {"str1", "str2"});
	gb.setListOfArrays(list);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.registerCustomEditor(String.class, new StringTrimmerEditor(false));
	bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
	assertEquals("str3", bw.getPropertyValue("listOfArrays[0][1]"));
	assertEquals("str3", gb.getListOfArrays().get(0)[1]);
}
 
Example 5
Source File: BeanWrapperGenericsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericListOfArrays() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<String>();
	ArrayList<String[]> list = new ArrayList<String[]>();
	list.add(new String[] {"str1", "str2"});
	gb.setListOfArrays(list);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
	assertEquals("str3 ", bw.getPropertyValue("listOfArrays[0][1]"));
	assertEquals("str3 ", gb.getListOfArrays().get(0)[1]);
}
 
Example 6
Source File: BeanWrapperGenericsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericListOfArraysWithElementConversion() throws MalformedURLException {
	GenericBean<String> gb = new GenericBean<String>();
	ArrayList<String[]> list = new ArrayList<String[]>();
	list.add(new String[] {"str1", "str2"});
	gb.setListOfArrays(list);
	BeanWrapper bw = new BeanWrapperImpl(gb);
	bw.registerCustomEditor(String.class, new StringTrimmerEditor(false));
	bw.setPropertyValue("listOfArrays[0][1]", "str3 ");
	assertEquals("str3", bw.getPropertyValue("listOfArrays[0][1]"));
	assertEquals("str3", gb.getListOfArrays().get(0)[1]);
}