public class ASMWrapper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ASMWrapper.MethodVisitorAccess
A wrapper for the ASM method visitor.
|
| Modifier and Type | Method and Description |
|---|---|
static ASMWrapper |
create(int access,
java.lang.String name,
java.lang.String signature,
java.lang.String superName,
java.lang.String[] interfaces)
Create a new ASM wrapper with the given class properties.
|
java.lang.Class<?> |
defineAnonymously(java.lang.Class<?> parent)
Define the class anonymously.
|
java.lang.Class<?> |
defineMetafactory(java.lang.Class<?> parent)
Define the class as a strong nestmate (like the
LambdaMetafactory). |
static java.lang.String |
desc(java.lang.Class<?> clazz)
Get the descriptor for the given class.
|
static java.lang.String |
desc(java.lang.Class<?>[] parameterTypes,
java.lang.Class<?> returnType)
Get the descriptor for the given parameter types and return type.
|
static java.lang.String |
desc(java.lang.reflect.Method method)
Get the descriptor for the given method.
|
static java.lang.String |
desc(java.lang.String className)
Get a descriptor for the given class name.
|
static int |
getLoadOpcode(java.lang.Class<?> clazz)
Get the fitting return opcode for the given type.
|
static int |
getReturnOpcode(java.lang.Class<?> clazz)
Get the fitting return opcode for the given type.
|
static int |
opcode(java.lang.String name)
Get an opcode by its name.
|
static java.lang.String |
slash(java.lang.Class<?> clazz)
Get the name of the class with slashes instead of dots.
|
static java.lang.String |
slash(java.lang.String className)
Replace all dots with slashes.
|
byte[] |
toByteArray()
Get the byte array of the generated class.
|
void |
visitField(int access,
java.lang.String name,
java.lang.String descriptor,
java.lang.String signature,
java.lang.Object value)
Visit a field in the class.
|
ASMWrapper.MethodVisitorAccess |
visitMethod(int access,
java.lang.String name,
java.lang.String descriptor,
java.lang.String signature,
java.lang.String[] exceptions)
Visit a method in the class.
|
public static int opcode(java.lang.String name)
name - The name of the opcodejava.lang.NullPointerException - If the opcode does not existpublic static java.lang.String slash(java.lang.String className)
className - The class namepublic static java.lang.String slash(java.lang.Class<?> clazz)
clazz - The classpublic static java.lang.String desc(java.lang.String className)
className - The class namepublic static java.lang.String desc(java.lang.Class<?> clazz)
clazz - The classpublic static java.lang.String desc(java.lang.reflect.Method method)
method - The methodpublic static java.lang.String desc(java.lang.Class<?>[] parameterTypes,
java.lang.Class<?> returnType)
parameterTypes - The parameter typesreturnType - The return typepublic static int getLoadOpcode(java.lang.Class<?> clazz)
clazz - The typepublic static int getReturnOpcode(java.lang.Class<?> clazz)
Void will return RETURN.clazz - The typepublic static ASMWrapper create(int access, @Nonnull java.lang.String name, @Nullable java.lang.String signature, @Nonnull java.lang.String superName, @Nullable java.lang.String[] interfaces)
access - The access flagsname - The class namesignature - The signaturesuperName - The super class nameinterfaces - The interfacespublic void visitField(int access,
@Nonnull
java.lang.String name,
@Nonnull
java.lang.String descriptor,
@Nullable
java.lang.String signature,
@Nullable
java.lang.Object value)
access - The access flagsname - The field namedescriptor - The field descriptorsignature - The field signaturevalue - The field valuepublic ASMWrapper.MethodVisitorAccess visitMethod(int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exceptions)
access - The access flagsname - The method namedescriptor - The method descriptorsignature - The method signatureexceptions - The exceptionspublic byte[] toByteArray()
public java.lang.Class<?> defineAnonymously(java.lang.Class<?> parent)
parent - The parent classpublic java.lang.Class<?> defineMetafactory(java.lang.Class<?> parent)
LambdaMetafactory).parent - The parent class