avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon/src/java/org/apache/avalon/util ObjectUtil.java
Date Wed, 28 Mar 2001 09:45:03 GMT
donaldp     01/03/28 01:45:03

  Modified:    src/java/org/apache/avalon/camelot DefaultLoader.java
  Added:       src/compat/org/apache/avalon/util ObjectUtil.java
  Removed:     src/java/org/apache/avalon/util ObjectUtil.java
  Log:
  Deprecated ObjectUtil as it was a convenience class that wasn't cnvenient.
  
  Revision  Changes    Path
  1.1                  jakarta-avalon/src/compat/org/apache/avalon/util/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.avalon.util;
  
  /**
   * This class provides basic facilities for manipulating objects.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   * deprecated This class should not be used - it was a convenience class that wasn't convenient
;)
   */
  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
      {
          return createObject( Thread.currentThread().getContextClassLoader(), classname );
      }
  }
  
  
  
  1.3       +1 -2      jakarta-avalon/src/java/org/apache/avalon/camelot/DefaultLoader.java
  
  Index: DefaultLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/camelot/DefaultLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultLoader.java	2001/03/02 06:39:16	1.2
  +++ DefaultLoader.java	2001/03/28 09:45:03	1.3
  @@ -9,7 +9,6 @@
   
   import java.net.URL;
   import java.net.URLClassLoader;
  -import org.apache.avalon.util.ObjectUtil;
   import org.apache.avalon.util.StringUtil;
   
   /**
  @@ -79,7 +78,7 @@
       {
           try
           {
  -            return ObjectUtil.createObject( m_classLoader, classname );
  +            return m_classLoader.loadClass( classname ).newInstance();
           }
           catch( final ClassNotFoundException cnfe )
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message