ehcache

net.sf.ehcache.util
Class ClassLoaderUtil

java.lang.Object
  extended by net.sf.ehcache.util.ClassLoaderUtil

public final class ClassLoaderUtil
extends Object

Keeps all classloading in ehcache consistent.

Version:
$Id: ClassLoaderUtil.java 8927 2014-04-15 22:06:53Z teck $
Author:
Greg Luck

Method Summary
static Object createNewInstance(ClassLoader loader, String className)
          Creates a new class instance with the given loader.
static Object createNewInstance(ClassLoader loader, String className, Class[] argTypes, Object[] args)
          Creates a new class instance and passes args to the constructor call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createNewInstance

public static Object createNewInstance(ClassLoader loader,
                                       String className)
                                throws CacheException
Creates a new class instance with the given loader. Logs errors along the way.

Parameters:
loader - the classloader to load the class
className - a fully qualified class name
Returns:
the newly created instance
Throws:
CacheException - if instance cannot be created due to a missing class or exception

createNewInstance

public static Object createNewInstance(ClassLoader loader,
                                       String className,
                                       Class[] argTypes,
                                       Object[] args)
                                throws CacheException
Creates a new class instance and passes args to the constructor call. Logs errors along the way.

Parameters:
loader - the classloader to load the class
className - a fully qualified class name
argTypes - Types for constructor argument parameters
args - Values for constructor argument parameters
Returns:
the newly created instance
Throws:
CacheException - if instance cannot be created due to a missing class or exception

ehcache

Copyright 2001-2014, Terracotta, Inc.