本文整理匯總了Java中org.springframework.beans.BeanWrapperImpl.setAutoGrowNestedPaths方法的典型用法代碼示例。如果您正苦於以下問題:Java BeanWrapperImpl.setAutoGrowNestedPaths方法的具體用法?Java BeanWrapperImpl.setAutoGrowNestedPaths怎麽用?Java BeanWrapperImpl.setAutoGrowNestedPaths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.BeanWrapperImpl
的用法示例。
在下文中一共展示了BeanWrapperImpl.setAutoGrowNestedPaths方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testBeanWrapperCreatesNewNestedMaps
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testBeanWrapperCreatesNewNestedMaps() throws Exception {
TargetWithNestedMap target = new TargetWithNestedMap();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
// For a nested map, you only have to get an element of it for it to be created
wrapper.getPropertyValue("nested[foo]");
// To decide what type to create for nested[foo] we need to look ahead and see
// what the user is trying to bind it to, e.g. if nested[foo][bar] then it's a map
wrapper.setPropertyValue("nested[foo]", new LinkedHashMap<String, Object>());
// But it might equally well be a collection, if nested[foo][0]
wrapper.setPropertyValue("nested[foo]", new ArrayList<Object>());
// Then it would have to be actually bound to get the list to auto-grow
wrapper.setPropertyValue("nested[foo][0]", "bar");
assertThat(wrapper.getPropertyValue("nested[foo][0]")).isNotNull();
}
示例2: testAutoGrowWithFuzzyNameUnderscores
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowWithFuzzyNameUnderscores() throws Exception {
TargetWithNestedMap target = new TargetWithNestedMap();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
String result = binder.normalizePath(wrapper, "nes_ted[foo][bar]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat("nested[foo][bar]").isEqualTo(result);
assertThat(wrapper.getPropertyValue("nested[foo][bar]")).isNotNull();
}
示例3: testBeanWrapperCreatesNewMapEntries
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testBeanWrapperCreatesNewMapEntries() throws Exception {
TargetWithNestedMapOfBean target = new TargetWithNestedMapOfBean();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
// For a nested map, you only have to get an element of it for it to be created
wrapper.getPropertyValue("nested[foo]");
wrapper.setPropertyValue("nested[foo].foo", "bar");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat(wrapper.getPropertyValue("nested[foo]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:BindingPreparationTests.java
示例4: testListOfBeansWithList
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testListOfBeansWithList() throws Exception {
TargetWithNestedListOfBeansWithList target = new TargetWithNestedListOfBeansWithList();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
binder.normalizePath(wrapper, "nested[0].list[1]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat(wrapper.getPropertyValue("nested[0].list[1]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:BindingPreparationTests.java
示例5: testAutoGrowNewNestedMapOfBeansWithPeriod
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowNewNestedMapOfBeansWithPeriod() throws Exception {
TargetWithNestedMapOfBean target = new TargetWithNestedMapOfBean();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
String result = binder.normalizePath(wrapper, "nested.foo.foo");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat("nested[foo].foo").isEqualTo(result);
}
示例6: testAutoGrowNewNestedMapOfMaps
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowNewNestedMapOfMaps() throws Exception {
TargetWithNestedMap target = new TargetWithNestedMap();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
String result = binder.normalizePath(wrapper, "nested[foo][bar]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat("nested[foo][bar]").isEqualTo(result);
assertThat(wrapper.getPropertyValue("nested[foo][bar]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:BindingPreparationTests.java
示例7: testAutoGrowNewNestedMapOfBeans
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowNewNestedMapOfBeans() throws Exception {
TargetWithNestedMapOfBean target = new TargetWithNestedMapOfBean();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
String result = binder.normalizePath(wrapper, "nested[foo].foo");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat("nested[foo].foo").isEqualTo(result);
assertThat(wrapper.getPropertyValue("nested[foo]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:BindingPreparationTests.java
示例8: testAutoGrowNewNestedMapOfListOfString
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowNewNestedMapOfListOfString() throws Exception {
TargetWithNestedMapOfListOfString target = new TargetWithNestedMapOfListOfString();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
binder.normalizePath(wrapper, "nested[foo][0]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat(wrapper.getPropertyValue("nested[foo]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:BindingPreparationTests.java
示例9: testAutoGrowListOfMaps
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowListOfMaps() throws Exception {
TargetWithNestedListOfMaps target = new TargetWithNestedListOfMaps();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
binder.normalizePath(wrapper, "nested[0][foo]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat(wrapper.getPropertyValue("nested[0]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:BindingPreparationTests.java
示例10: testAutoGrowListOfLists
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowListOfLists() throws Exception {
TargetWithNestedListOfLists target = new TargetWithNestedListOfLists();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
binder.normalizePath(wrapper, "nested[0][1]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat(wrapper.getPropertyValue("nested[0][1]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:BindingPreparationTests.java
示例11: testBeanWrapperCreatesNewObjects
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testBeanWrapperCreatesNewObjects() throws Exception {
TargetWithNestedObject target = new TargetWithNestedObject();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
// For a nested object, you have to set a property for it to be created
wrapper.setPropertyValue("nested.foo", "bar");
wrapper.getPropertyValue("nested");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:BindingPreparationTests.java
示例12: testBeanWrapperLists
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testBeanWrapperLists() throws Exception {
TargetWithNestedMapOfListOfString target = new TargetWithNestedMapOfListOfString();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
TypeDescriptor descriptor = wrapper.getPropertyTypeDescriptor("nested");
assertThat(descriptor.isMap()).isTrue();
wrapper.getPropertyValue("nested[foo]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
// You also need to bind to a value here
wrapper.setPropertyValue("nested[foo][0]", "bar");
wrapper.getPropertyValue("nested[foo][0]");
assertThat(wrapper.getPropertyValue("nested[foo]")).isNotNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:BindingPreparationTests.java
示例13: testListOfBeansWithListAndNoPeriod
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testListOfBeansWithListAndNoPeriod() throws Exception {
TargetWithNestedListOfBeansWithList target = new TargetWithNestedListOfBeansWithList();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
binder.normalizePath(wrapper, "nested[0]list[1]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat(wrapper.getPropertyValue("nested[0].list[1]")).isNotNull();
}
示例14: testAutoGrowWithFuzzyNameCapitals
import org.springframework.beans.BeanWrapperImpl; //導入方法依賴的package包/類
@Test
public void testAutoGrowWithFuzzyNameCapitals() throws Exception {
TargetWithNestedMap target = new TargetWithNestedMap();
BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
wrapper.setAutoGrowNestedPaths(true);
RelaxedDataBinder binder = new RelaxedDataBinder(target);
String result = binder.normalizePath(wrapper, "NESTED[foo][bar]");
assertThat(wrapper.getPropertyValue("nested")).isNotNull();
assertThat("nested[foo][bar]").isEqualTo(result);
assertThat(wrapper.getPropertyValue("nested[foo][bar]")).isNotNull();
}