| Modifier and Type | Field and Description | 
|---|---|
static int | 
ACC_ABSTRACT  | 
static int | 
ACC_ANNOTATION  | 
static int | 
ACC_ENUM  | 
static int | 
ACC_FINAL  | 
static int | 
ACC_INTERFACE  | 
static int | 
ACC_PUBLIC  | 
static int | 
ACC_SUPER  | 
static int | 
ACC_SYNTHETIC  | 
static int | 
CONSTANT_Class  | 
static int | 
CONSTANT_Double  | 
static int | 
CONSTANT_Fieldref  | 
static int | 
CONSTANT_Float  | 
static int | 
CONSTANT_Integer  | 
static int | 
CONSTANT_InterfaceMethodref  | 
static int | 
CONSTANT_InvokeDynamic  | 
static int | 
CONSTANT_Long  | 
static int | 
CONSTANT_MethodHandle  | 
static int | 
CONSTANT_Methodref  | 
static int | 
CONSTANT_MethodType  | 
static int | 
CONSTANT_NameAndType  | 
static int | 
CONSTANT_String  | 
static int | 
CONSTANT_Utf8  | 
static byte[] | 
MAGIC  | 
static byte | 
OPS_aload_0  | 
static byte | 
OPS_areturn  | 
static byte | 
OPS_dup  | 
static byte | 
OPS_invokespecial  | 
static byte | 
OPS_new  | 
static byte | 
OPS_return  | 
static byte[] | 
VERSION  | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
classNameToInternalClassName(String className)
Will convert a class name to its name in the class definition format (e.g  
org.objenesis.EmptyClass
 becomes org/objenesis/EmptyClass) | 
static String | 
classNameToResource(String className)
Will convert a class name to its class loader resource name (e.g  
org.objenesis.EmptyClass
 becomes org/objenesis/EmptyClass.class) | 
static <T> Class<T> | 
defineClass(String className,
           byte[] b,
           ClassLoader loader)
Define a class in the provided class loader from the array of bytes. 
 | 
static <T> Class<T> | 
getExistingClass(ClassLoader classLoader,
                String className)
Check if this class already exists in the class loader and return it if it does 
 | 
static byte[] | 
readClass(String className)
Read the bytes of a class from the classpath 
 | 
static void | 
writeClass(String fileName,
          byte[] bytes)
Write all class bytes to a file. 
 | 
public static final byte OPS_aload_0
public static final byte OPS_invokespecial
public static final byte OPS_return
public static final byte OPS_new
public static final byte OPS_dup
public static final byte OPS_areturn
public static final int CONSTANT_Utf8
public static final int CONSTANT_Integer
public static final int CONSTANT_Float
public static final int CONSTANT_Long
public static final int CONSTANT_Double
public static final int CONSTANT_Class
public static final int CONSTANT_String
public static final int CONSTANT_Fieldref
public static final int CONSTANT_Methodref
public static final int CONSTANT_InterfaceMethodref
public static final int CONSTANT_NameAndType
public static final int CONSTANT_MethodHandle
public static final int CONSTANT_MethodType
public static final int CONSTANT_InvokeDynamic
public static final int ACC_PUBLIC
public static final int ACC_FINAL
public static final int ACC_SUPER
public static final int ACC_INTERFACE
public static final int ACC_ABSTRACT
public static final int ACC_SYNTHETIC
public static final int ACC_ANNOTATION
public static final int ACC_ENUM
public static final byte[] MAGIC
public static final byte[] VERSION
public static <T> Class<T> defineClass(String className, byte[] b, ClassLoader loader) throws Exception
ReflectUtils.defineClassT - type of the class returnedclassName - class name in the format org.objenesis.MyClassb - bytes representing the classloader - the class loader where the class will be loadedException - whenever something goes wrongpublic static byte[] readClass(String className) throws IOException
className - full class name including the packageIllegalArgumentException - if the class is longer than 2500 bytesIOException - if we fail to read the classpublic static void writeClass(String fileName, byte[] bytes) throws IOException
fileName - file where the bytes will be writtenbytes - bytes representing the classIOException - if we fail to write the classpublic static String classNameToInternalClassName(String className)
org.objenesis.EmptyClass
 becomes org/objenesis/EmptyClass)className - full class name including the packagepublic static String classNameToResource(String className)
org.objenesis.EmptyClass
 becomes org/objenesis/EmptyClass.class)className - full class name including the packagepublic static <T> Class<T> getExistingClass(ClassLoader classLoader, String className)
T - type of the class returnedclassLoader - Class loader where to search the classclassName - Class name with full pathCopyright © 2006–2017 Joe Walnes, Henri Tremblay, Leonardo Mesquita. All rights reserved.