嗨,我有一个情况将对象转换为列表.
我从请求参数中获取了对象值List.
我需要将此Object转换为List
这个类名我可以在运行时获得String值.
样品:
private static Object createList(Object object){
private static Object createList(Object object){
List dd = (List)object;
//the List contains the objects of this class
Class cls = Class.forName(dd.get(0).getClass().getName());
//I would like to cast this Object to List<thisClass>
}
Run Code Online (Sandbox Code Playgroud)
}
这怎么可以实现?有人可以帮助我吗?
java ×1