Package io.micronaut.sourcegen.bytecode
Class ByteCodeWriter
java.lang.Object
io.micronaut.sourcegen.bytecode.ByteCodeWriter
Generates the classes directly by writing the bytecode.
- Since:
- 1.5
- Author:
- Denis Stepanov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Writes the bytecode of generated class.byte[]
write
(ObjectDef objectDef, @Nullable ClassTypeDef outerType) Writes the bytecode of generated class.void
writeClass
(org.objectweb.asm.ClassVisitor classVisitor, ClassDef classDef) Write an interface.void
writeClass
(org.objectweb.asm.ClassVisitor classVisitor, ClassDef classDef, @Nullable ClassTypeDef outerType) Write an interface.void
writeField
(org.objectweb.asm.ClassVisitor classVisitor, ObjectDef objectDef, FieldDef fieldDef) Write an enum.void
writeInterface
(org.objectweb.asm.ClassVisitor classVisitor, InterfaceDef interfaceDef, @Nullable ClassTypeDef outerType) Write an interface.void
writeMethod
(org.objectweb.asm.ClassVisitor classVisitor, @Nullable ObjectDef objectDef, MethodDef methodDef) Write an interface.void
writeObject
(org.objectweb.asm.ClassVisitor classVisitor, ObjectDef objectDef) Write an object.void
writeObject
(org.objectweb.asm.ClassVisitor classVisitor, ObjectDef objectDef, @Nullable ClassTypeDef outerType) Write an object.void
writeRecord
(org.objectweb.asm.ClassVisitor classVisitor, RecordDef recordDef) Write an interface.void
writeRecord
(org.objectweb.asm.ClassVisitor classVisitor, RecordDef recordDef, @Nullable ClassTypeDef outerType) Write an interface.
-
Constructor Details
-
ByteCodeWriter
public ByteCodeWriter() -
ByteCodeWriter
public ByteCodeWriter(boolean checkClass, boolean visitMaxs)
-
-
Method Details
-
writeObject
Write an object.- Parameters:
classVisitor
- The class visitorobjectDef
- The object definition
-
writeObject
public void writeObject(org.objectweb.asm.ClassVisitor classVisitor, ObjectDef objectDef, @Nullable @Nullable ClassTypeDef outerType) Write an object.- Parameters:
classVisitor
- The class visitorobjectDef
- The object definitionouterType
- The outer type
-
writeField
public void writeField(org.objectweb.asm.ClassVisitor classVisitor, ObjectDef objectDef, FieldDef fieldDef) Write an enum.- Parameters:
classVisitor
- The class visitorobjectDef
- The object definitionfieldDef
- The field definition
-
writeInterface
public void writeInterface(org.objectweb.asm.ClassVisitor classVisitor, InterfaceDef interfaceDef, @Nullable @Nullable ClassTypeDef outerType) Write an interface.- Parameters:
classVisitor
- The class visitorinterfaceDef
- The interface definitionouterType
- The outer type
-
writeRecord
Write an interface.- Parameters:
classVisitor
- The class visitorrecordDef
- The record definition
-
writeRecord
public void writeRecord(org.objectweb.asm.ClassVisitor classVisitor, RecordDef recordDef, @Nullable @Nullable ClassTypeDef outerType) Write an interface.- Parameters:
classVisitor
- The class visitorrecordDef
- The record definitionouterType
- The outer type
-
writeClass
Write an interface.- Parameters:
classVisitor
- The class visitorclassDef
- The class definition
-
writeClass
public void writeClass(org.objectweb.asm.ClassVisitor classVisitor, ClassDef classDef, @Nullable @Nullable ClassTypeDef outerType) Write an interface.- Parameters:
classVisitor
- The class visitorclassDef
- The class definitionouterType
- The outer type
-
writeMethod
public void writeMethod(org.objectweb.asm.ClassVisitor classVisitor, @Nullable @Nullable ObjectDef objectDef, MethodDef methodDef) Write an interface.- Parameters:
classVisitor
- The class visitorobjectDef
- The object definitionmethodDef
- The method definition
-
write
Writes the bytecode of generated class.- Parameters:
objectDef
- The object definition.- Returns:
- The bytes
-
write
Writes the bytecode of generated class.- Parameters:
objectDef
- The object definition.outerType
- The outer type.- Returns:
- The bytes
-