You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/02/26 01:41:04 UTC
cvs commit: jakarta-avalon/proposal/4.0/src/java/org/apache/aut ObjectUtil.java
donaldp 01/02/25 16:41:04
Added: proposal/4.0/src/java/org/apache/aut ObjectUtil.java
Log:
Added object util to aut
Revision Changes Path
1.1 jakarta-avalon/proposal/4.0/src/java/org/apache/aut/ObjectUtil.java
Index: ObjectUtil.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.aut;
/**
* This class provides basic facilities for manipulating objects.
*
* @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public final class ObjectUtil
{
/**
* Private constructor to prevent instantiation.
*/
private ObjectUtil()
{
}
public static boolean isEqual( final Object o1, final Object o2 )
{
if( null == o1 )
{
if( null == o2 )
{
return true;
}
else
{
return false;
}
}
else if( null == o2 )
{
return false;
}
else
{
return o1.equals( o2 );
}
}
public static Object createObject( final ClassLoader classLoader, final String classname )
throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
final Class clazz = classLoader.loadClass( classname );
return clazz.newInstance();
}
public static Object createObject( final String classname )
throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
final Class clazz = Class.forName( classname );
return clazz.newInstance();
}
}