|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.search.util.PluginLoader
public class PluginLoader
Utility class to load instances of other classes by using a fully qualified name, or from a class type. Uses reflection and throws SearchException(s) with proper descriptions of the error, like the target class is missing a proper constructor, is an interface, is not found...
| Constructor Summary | |
|---|---|
PluginLoader()
|
|
| Method Summary | ||
|---|---|---|
static void |
checkHasValidconstructor(java.lang.Class<?> classToLoad,
java.lang.String componentDescription)
Verifies if target class has a no-args constructor, and that it is accessible in current security manager. |
|
static
|
instanceFromClass(java.lang.Class<T> targetSuperType,
java.lang.Class<?> classToLoad,
java.lang.String componentDescription)
Creates an instance of target class |
|
static
|
instanceFromName(java.lang.Class<T> targetSuperType,
java.lang.String classNameToLoad,
java.lang.Class<?> caller,
java.lang.String componentDescription)
Creates an instance of a target class designed by fully qualified name |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PluginLoader()
| Method Detail |
|---|
public static <T> T instanceFromName(java.lang.Class<T> targetSuperType,
java.lang.String classNameToLoad,
java.lang.Class<?> caller,
java.lang.String componentDescription)
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 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 error
SearchException - 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(java.lang.Class<T> targetSuperType,
java.lang.Class<?> classToLoad,
java.lang.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 messages
SearchException - wrapping other error types with a proper error message for all kind of problems, like
missing proper constructor, wrong type, security errors.
public static void checkHasValidconstructor(java.lang.Class<?> classToLoad,
java.lang.String componentDescription)
classToLoad - the class type to checkcomponentDescription - adds a meaningful description to the type to describe in the
exception message
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||