properties - How to automatically convert property values from String in Java? -
suppose i've bean has many properties of many types int, string, date, etc... primitive types of course. , want fill string representations of values, without writing parsing code... how do that?
bean frameworks spring you. if want write need use reflection find type required , use correct conversion code.
if have class this:
public class mybean { private int count; public void setcount(int count) { this.count = count; } }
and application context this:
<beans> <bean id="mybean1" class="mybean"> <property name="count" value="3"/> </bean> </beans>
then should work fine you. have @ docs more info, examples better docs though.
Comments
Post a Comment