org.hibernate.search.util.impl
public class ClassLoaderHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static Analyzer |
analyzerInstanceFromClass(Class<?> classToInstantiate,
Version luceneMatchVersion) |
static Class |
classForName(String name,
ClassLoader classLoader)
Perform resolution of a class name.
|
static Class<?> |
classForName(String classNameToLoad,
ClassLoader classLoader,
String componentDescription) |
static Enumeration<URL> |
getResources(String resourceName,
Class<?> caller)
Load all resources matching a specific name
|
static <T> T |
instanceFromClass(Class<T> targetSuperType,
Class<?> classToLoad,
String componentDescription)
Creates an instance of target class
|
static <T> T |
instanceFromName(Class<T> targetSuperType,
String classNameToLoad,
Class<?> caller,
String componentDescription)
Deprecated.
|
static <T> T |
instanceFromName(Class<T> targetSuperType,
String classNameToLoad,
ClassLoader fallbackClassLoader,
String componentDescription)
Creates an instance of a target class specified by the fully qualified class name using a
ClassLoader
as fallback when the class cannot be found in the context one. |
public static Enumeration<URL> getResources(String resourceName, Class<?> caller)
resourceName - the resource namecaller - the caller@Deprecated public static <T> T instanceFromName(Class<T> targetSuperType, String classNameToLoad, Class<?> caller, String componentDescription)
instanceFromName(Class, String, ClassLoader, String) insteadT - matches the type of targetSuperType: defines the return typetargetSuperType - the return type of the function, the classNameToLoad will be checked
to be assignable to this type.classNameToLoad - a fully qualified class name, whose type is assignable to targetSuperTypecaller - the class of the caller, needed for classloading purposescomponentDescription - a meaningful description of the role the instance will have,
used to enrich error messages to describe the context of the errorSearchException - wrapping other error types with a proper error message for all kind of problems, like
classNotFound, missing proper constructor, wrong type, security errors.public static <T> T instanceFromName(Class<T> targetSuperType, String classNameToLoad, ClassLoader fallbackClassLoader, String componentDescription)
ClassLoader
as fallback when the class cannot be found in the context one.T - matches the type of targetSuperType: defines the return typetargetSuperType - the return type of the function, the classNameToLoad will be checked
to be assignable to this type.classNameToLoad - a fully qualified class name, whose type is assignable to targetSuperTypefallbackClassLoader - the ClassLoader used when the class cannot be found in the context onecomponentDescription - a meaningful description of the role the instance will have,
used to enrich error messages to describe the context of the errorSearchException - wrapping other error types with a proper error message for all kind of problems, like
classNotFound, missing proper constructor, wrong type, security errors.public static <T> T instanceFromClass(Class<T> targetSuperType, Class<?> classToLoad, String componentDescription)
T - the type of targetSuperType: defines the return typetargetSuperType - the created instance will be checked to be assignable to this typeclassToLoad - the class to be instantiatedcomponentDescription - a role name/description to contextualize error messagesSearchException - wrapping other error types with a proper error message for all kind of problems, like
missing proper constructor, wrong type, security errors.public static Analyzer analyzerInstanceFromClass(Class<?> classToInstantiate, Version luceneMatchVersion)
public static Class<?> classForName(String classNameToLoad, ClassLoader classLoader, String componentDescription)
public static Class classForName(String name, ClassLoader classLoader) throws ClassNotFoundException
Class.forName(String, boolean, ClassLoader) using the caller's classloadername - The class nameclassLoader - The classloader from which this call originated.ClassNotFoundException - From Class.forName(String, boolean, ClassLoader).Copyright © 2006-2015 Red Hat, Inc. All Rights Reserved