Tani :
I know this is very basic question yet I am unable to get the perfect answer. I have one bean named Order
in which there is one object product_size
such as
public Class Order{
private String product_size;
}
Setter and Getter methods are defined respectively in that class. The problem is that product_size
may contain string variable
such as S
or Integer value
such as 7
.
I am unable to store the Integer value in that bean object.
Tani :
I have done with only one bean instance and I am check that if value is string it should be added in bean object Simply else Integer.toString()
method will convert the int value to String.
Example is given below-
String str; // it is dynamic let there are two values in this 'S' and 8
if (str instancof String){
order.setProduct_Size(str);
}else{
order.setProduct_Size(Integer.toString(str));
}