Example usage for org.springframework.beans BeanWrapperImpl useConfigValueEditors

List of usage examples for org.springframework.beans BeanWrapperImpl useConfigValueEditors

Introduction

In this page you can find the example usage for org.springframework.beans BeanWrapperImpl useConfigValueEditors.

Prototype

public void useConfigValueEditors() 

Source Link

Document

Activate config value editors which are only intended for configuration purposes, such as org.springframework.beans.propertyeditors.StringArrayPropertyEditor .

Usage

From source file:org.springframework.beans.BeanWrapperTests.java

@Test
public void testStringArrayPropertyWithStringSplitting() throws Exception {
    PropsTester pt = new PropsTester();
    BeanWrapperImpl bw = new BeanWrapperImpl(pt);
    bw.useConfigValueEditors();
    bw.setPropertyValue("stringArray", "a1,b2");
    assertTrue("stringArray length = 2", pt.stringArray.length == 2);
    assertTrue("correct values", pt.stringArray[0].equals("a1") && pt.stringArray[1].equals("b2"));
}

From source file:org.springframework.beans.BeanWrapperTests.java

@Test
public void testIntArrayPropertyWithStringSplitting() throws Exception {
    PropsTester pt = new PropsTester();
    BeanWrapperImpl bw = new BeanWrapperImpl(pt);
    bw.useConfigValueEditors();
    bw.setPropertyValue("intArray", "4,5");
    assertTrue("intArray length = 2", pt.intArray.length == 2);
    assertTrue("correct values", pt.intArray[0] == 4 && pt.intArray[1] == 5);
}