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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -