public final class ClassFactory
extends java.lang.Object
This code handles the case where the class is not public or the constructor is not public.
| Constructor | Description |
|---|---|
ClassFactory() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
cleanCache() |
|
static <T> T |
create(java.lang.Class<T> clazz) |
The same as
create0(java.lang.Class<T>) but with an error handling to make
the instantiation error fatal. |
static java.lang.Object |
create(java.lang.reflect.Method method) |
Call a method in the factory class to get the object.
|
static <T> T |
create0(java.lang.Class<T> clazz) |
Creates a new instance of the class but throw exceptions without catching it.
|
static <T> java.lang.Class<? extends T> |
inferImplClass(java.lang.Class<T> fieldType,
java.lang.Class[] knownImplClasses) |
Infers the instanciable implementation class that can be assigned to the given field type.
|
public static void cleanCache()
public static <T> T create0(java.lang.Class<T> clazz)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.InstantiationException
java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.InstantiationExceptionpublic static <T> T create(java.lang.Class<T> clazz)
create0(java.lang.Class<T>) but with an error handling to make
the instantiation error fatal.public static java.lang.Object create(java.lang.reflect.Method method)
public static <T> java.lang.Class<? extends T> inferImplClass(java.lang.Class<T> fieldType,
java.lang.Class[] knownImplClasses)
Copyright © 2017 Oracle Corporation. All rights reserved.