为什么java在以下情况下返回java.util.LinkedHashMap。。。复杂的
我的代码如下为什么java在以下情况下返回java.util.LinkedHashMap。。。复杂的,java,list,generics,collections,casting,Java,List,Generics,Collections,Casting,我的代码如下 @ResponseBody @RequestMapping(value ="/updateAll", method=RequestMethod.POST) public JSONObject update( @RequestBody List<T> list){ try{ T entity = list.get(0); System.out.println(entity.getClass()); dbSer
@ResponseBody
@RequestMapping(value ="/updateAll", method=RequestMethod.POST)
public JSONObject update( @RequestBody List<T> list){
try{
T entity = list.get(0);
System.out.println(entity.getClass());
dbService.update(entityName + ".update", list);
return jsonResult(null, null, null, 0);
}catch(Exception ex){
return jsonResult(null, null, ex, 0);
}
}
这将准确地打印实体名称,没有任何问题
谁能解释一下为什么会这样?我在哪里可以了解更多关于这方面的信息 /**
/**
* Returns the runtime class of this {@code Object}. The returned
* {@code Class} object is the object that is locked by {@code
* static synchronized} methods of the represented class.
*
* <p><b>The actual result type is {@code Class<? extends |X|>}
* where {@code |X|} is the erasure of the static type of the
* expression on which {@code getClass} is called.</b> For
* example, no cast is required in this code fragment:</p>
*
* <p>
public final native Class<?> getClass();
*返回此{@code对象}的运行时类。返回
*{@code Class}对象是由{@code锁定的对象
*表示的类的静态同步}方法。
*
*实际的结果类型是{@code Class getClass();
不管引用类型是什么。方法getClass()
返回运行时类
/**
* Returns the runtime class of this {@code Object}. The returned
* {@code Class} object is the object that is locked by {@code
* static synchronized} methods of the represented class.
*
* <p><b>The actual result type is {@code Class<? extends |X|>}
* where {@code |X|} is the erasure of the static type of the
* expression on which {@code getClass} is called.</b> For
* example, no cast is required in this code fragment:</p>
*
* <p>
public final native Class<?> getClass();