T - The type of the classpublic class ClassDefiner<T>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> ClassDefiner<T> |
defineAnonymousClass(byte[] bytecode)
Define an anonymous class.
|
static java.lang.String |
generateClassName(java.lang.String name)
Generate a name for the defined class.
|
java.lang.Class<?> |
getClazz() |
T |
newInstance()
Create a new instance of the defined class.
|
T |
newInstance(java.lang.Class<?>[] types,
java.lang.Object[] values)
Create a new instance of the defined class using the given arguments.
|
T |
newInstance(java.lang.Object... args)
Create a new instance of the defined class using the given arguments.
|
public static java.lang.String generateClassName(java.lang.String name)
name - The name of the classpublic static <T> ClassDefiner<T> defineAnonymousClass(byte[] bytecode)
T - The type of the classbytecode - The bytecode of the classjava.lang.ClassCastException - When the defined class is not of the given typejava.lang.RuntimeException - When the class could not be definedpublic java.lang.Class<?> getClazz()
public T newInstance() throws java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException - When the constructor throws an exceptionjava.lang.NoSuchMethodException - When the class does not have a default constructorjava.lang.InstantiationException - When the class is abstractjava.lang.IllegalAccessException - When the class is not publicpublic T newInstance(java.lang.Object... args) throws java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException
args - The arguments for the constructorjava.lang.reflect.InvocationTargetException - When the constructor throws an exceptionjava.lang.NoSuchMethodException - When the class does not have a constructor with the given argumentsjava.lang.InstantiationException - When the class is abstractjava.lang.IllegalAccessException - When the class is not publicpublic T newInstance(java.lang.Class<?>[] types, java.lang.Object[] values) throws java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException, java.lang.IllegalAccessException
types - The types of the argumentsvalues - The arguments for the constructorjava.lang.NoSuchMethodException - When the class does not have a constructor with the given argumentsjava.lang.reflect.InvocationTargetException - When the constructor throws an exceptionjava.lang.InstantiationException - When the class is abstractjava.lang.IllegalAccessException - When the class is not public