Casting objects to Integer,string ,...
Posted
by Milan
on Stack Overflow
See other posts from Stack Overflow
or by Milan
Published on 2010-04-13T10:14:57Z
Indexed on
2010/04/14
8:13 UTC
Read the original article
Hit count: 221
Hello everybody!
I have one small problem. I have list of types(int,string,..)
ArrayList<Class> typeList;
and I have some input values;
ArrayList<Object> values;
How to cast some value to some type if I know which type from the typeList is the values;
typeList.get(i).cast(values.get(i));
<- this is not working???
Actualy I generate dynamic form in runtime. With Java reflection I get parameterTypes from methods from some class, I generate form with input fields and then i want to cast the text from the input fields to specific types from the paramterTypes that I got with Java reflection from some class.
© Stack Overflow or respective owner