org.apache.myfaces.extensions.cdi.core.api.util
Class ClassUtils
java.lang.Object
org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils
public class ClassUtils
- extends Object
- Author:
- Gerhard Petracek
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassUtils
public ClassUtils()
getClassLoader
public static ClassLoader getClassLoader(Object o)
- Detect the right ClassLoader.
The lookup order is determined by:
- ContextClassLoader of the current Thread
- ClassLoader of the given Object 'o'
- ClassLoader of this very CodiUtils class
- Parameters:
o
- if not null
it may get used to detect the classloader.
- Returns:
- The
ClassLoader
which should get used to create new instances
tryToLoadClassForName
public static Class tryToLoadClassForName(String name)
loadClassForName
public static Class loadClassForName(String name)
throws ClassNotFoundException
- Throws:
ClassNotFoundException
tryToInstantiateClass
public static <T> T tryToInstantiateClass(Class<T> targetClass)
tryToInstantiateClass
public static <T> T tryToInstantiateClass(Class targetClass,
Class<T> type)
tryToInstantiateClassForName
public static <T> T tryToInstantiateClassForName(String className,
Class<T> targetType)
tryToInstantiateClassForName
public static Object tryToInstantiateClassForName(String className)
instantiateClassForName
public static Object instantiateClassForName(String className)
throws ClassNotFoundException,
IllegalAccessException,
InstantiationException
- Throws:
ClassNotFoundException
IllegalAccessException
InstantiationException
getJarVersion
public static String getJarVersion(Class targetClass)
Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.