⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testdynabean.java

📁 基于数据库操作的封装
💻 JAVA
字号:
package org.shaoye.magic;

import org.shaoye.dynaBean.GenerateObj;
import org.apache.commons.beanutils.*;

import java.util.HashMap;


/**
 * @author zhangt
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class TestDynaBean {

  public static void main(String[] args) throws Exception{


		try
		{
		HashMap hashmap = new HashMap();
                hashmap.put("name1","a");
                hashmap.put("name2","b");
                hashmap.put("name3","c");
                hashmap.put("name4","d");


                GenerateObj obj = new GenerateObj( hashmap );

                DynaBean employee = ( DynaBean )obj.setDynaObject();


	      //System.out.println("subordinate.listIndexed[0]:");
	      //System.out.println(PropertyUtils.getProperty(employee,"subordinate.listIndexed[0]"));
	      //System.out.println("1:" + PropertyUtils.getProperty(employee,  "name1"));
	      //System.out.println("2:" + PropertyUtils.getProperty(employee,  "name2"));
	      //System.out.println("3:" + PropertyUtils.getProperty(employee,  "name3"));
	      //System.out.println("4:" + PropertyUtils.getProperty(employee,  "name4"));
              java.util.Set set = PropertyUtils.describe(employee).keySet();
              java.util.Iterator it = set.iterator();
              while(it.hasNext()){
                  System.out.println(it.next());
              }

		}
		catch( Exception ex )
		{
                  System.out.println(ex.toString());
		}

  }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -