[jboss-cvs] JBossCache/src/org/jboss/cache/util ...
Brian Stansberry
brian.stansberry at jboss.com
Wed Oct 25 00:44:42 EDT 2006
User: bstansberry
Date: 06/10/25 00:44:42
Added: src/org/jboss/cache/util Util.java
Log:
Extract multiple loadClass impls to a util class
Revision Changes Path
1.1 date: 2006/10/25 04:44:42; author: bstansberry; state: Exp;JBossCache/src/org/jboss/cache/util/Util.java
Index: Util.java
===================================================================
/*
* JBoss, Home of Professional Open Source.
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.util;
/**
* General utility methods used throughout the JBC code base.
*
* @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
* @version $Revision: 1.1 $
*/
public final class Util
{
/**
* Loads the specified class using this class's classloader, or, if it is <code>null</code>
* (i.e. this class was loaded by the bootstrap classloader), the system classloader.
* <p/>
* If loadtime instrumentation via GenerateInstrumentedClassLoader is used, this
* class may be loaded by the bootstrap classloader.
* </p>
*
* @param classname name of the class to load
* @return the class
* @throws ClassNotFoundException
*/
public static Class loadClass(String classname) throws ClassNotFoundException
{
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
return cl.loadClass(classname);
}
/** Prevent instantiation */
private Util() {}
}
More information about the jboss-cvs-commits
mailing list