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

📄 beanconfig.java

📁 留言版系统:这是在Eclipse环境下开发的
💻 JAVA
字号:
package cn.hxex.message.config;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;

import cn.hxex.message.exception.MessageException;

public class BeanConfig 
{
	private String id;
	private String type;

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}	
	
	private Object instance;
	public Object getInstance() 
	{
		if( null!=instance ) return instance;
		
		try
		{
			Class cls = Class.forName( getType() );
			instance = cls.newInstance();
			return instance;
		}
		catch( Exception ex )
		{
			throw new MessageException( "Couldn't find class:" + getType() );
		}
	}
	
	public String toString()
	{
		return ReflectionToStringBuilder.toString( this );
	}
}

⌨️ 快捷键说明

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