Types supported by Ibatis parameterClass and resultClass

You can see the supported alias types in the source code of ibatis: com.ibatis.sqlmap.engine.type.TypeHandlerFactory

putTypeAlias("string",String.class.getName());  
putTypeAlias("byte", Byte.class.getName());  
putTypeAlias("long", Long.class.getName());  
putTypeAlias("short", Short.class.getName());  
putTypeAlias("int", Integer.class.getName());  
putTypeAlias("integer", Integer.class.getName());  
putTypeAlias("double", Double.class.getName());  
putTypeAlias("float", Float.class.getName());  
putTypeAlias("boolean", Boolean.class.getName());  
putTypeAlias("date", Date.class.getName());  
putTypeAlias("decimal",BigDecimal.class.getName());  
putTypeAlias("object", Object.class.getName());  
putTypeAlias("map", Map.class.getName());  
putTypeAlias("hashmap", HashMap.class.getName());  
putTypeAlias("list", List.class.getName());  
putTypeAlias("arraylist",ArrayList.class.getName());  
putTypeAlias("collection", Collection.class.getName());  
putTypeAlias("iterator", Iterator.class.getName());  
putTypeAlias("cursor", java.sql.ResultSet.class.getName());  

When looking up the Class name according to the abbreviation, it will all be converted to lowercase and then searched

That is: resultClass= "string", resultClass= "String" are both possible

(1) If the full path is written, the full path must be capitalized correctly. For example, java.lang.string cannot be recognized, and a ClassCast error will be reported during conversion, which must be java.lang.String

(2) The specific class that can be instantiated must be input in resultClass, but the interface cannot be input. For example, hashmap is OK, but not map, because when processing the result, you need to instantiate resultClass first, and then assign it.

(3) parameterClass can input interface classes, such as list and map, because subclasses can be converted to parent classes

 

Other classes related to xml processing

com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient

com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324955405&siteId=291194637