一个简单的visio程序。
源代码在线查看: obj.java
package HAB.HcBean;
import java.lang.reflect.*;
import HPCore.Exception.HpException;
import HAB.HcBean.HalcyonAppletBeanInterface;
public class Obj
{
public static Object CreateObject(String obj) throws HpException
{
try
{
return CreateObject(null,obj);
}
catch(Exception he)
{
throw new HpException(0,"Couldn't instanceof "+obj);
}
}
public static Object CreateObject(java.awt.Container con,String obj) throws HpException
{
Object returnObj = null;
try
{
Class c = Class.forName(obj);
if (c != null)
{
returnObj = c.newInstance();
}
}
catch (Throwable ex)
{
throw new HpException(0,"Couldn't instanceof "+obj);
}
if (returnObj == null)
{
throw new HpException(0,"Couldn't instanceof "+obj);
}
if (returnObj instanceof HalcyonAppletBeanInterface)
{
return returnObj;
}
else
{
try
{
java.beans.BeanInfo bi = java.beans.Introspector.getBeanInfo(returnObj.getClass());
}
catch (Throwable ex)
{
throw new HpException(0,"Couldn't instanceof "+obj);
}
return returnObj;
}
}
}