Commonutils class-dependent jar packages: Commons-beanutils.jar, Commons-logging.jaruuid () methods * returns a random 32-bit long string * use: * can be used to do a variety of ID and other variables can not be repeated, the database table in the primary key can not be repeated, it is not repeated! @Test public void testunid () { String s=commonutils.uuid (); System.out.println (s); } role: Encapsulate data from a map into JavaBean * Requirements: * 1. Requires that the key name in map is the same as the property name in JavaBean, and is lost if the attribute name is not in JavaBean. If there is sex in the map, and JavaBean does not have sex,javabean in the sex is empty @Test public void testtobean ()//need to have a corresponding Javabean{id,name,age + set , get, tostring method} { /** * 1. Creating map */ map<string,object> map= New hashmap<string,object> (); map.put ("id", " 001 "); map.put (" Name "," Zouzou "); map.put ("Age", 21);//If the following 21 is a "21" string, it will be self-type converted map.put ("xxx", "xxx");//Data Loss example, JavaBean no XXX attribute person p=commonutils.tobean (Map, person.class); &NBSP;SYSTEM.OUT.PRINTLN (p); }
Java random 32-bit long string