Class ByteCodeWriter

java.lang.Object
io.micronaut.sourcegen.bytecode.ByteCodeWriter

public final class ByteCodeWriter extends Object
Generates the classes directly by writing the bytecode.
Since:
1.5
Author:
Denis Stepanov
  • Constructor Details

    • ByteCodeWriter

      public ByteCodeWriter()
    • ByteCodeWriter

      public ByteCodeWriter(boolean checkClass, boolean visitMaxs)
  • Method Details

    • writeObject

      public void writeObject(org.objectweb.asm.ClassVisitor classVisitor, ObjectDef objectDef)
      Write an object.
      Parameters:
      classVisitor - The class visitor
      objectDef - 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 visitor
      objectDef - The object definition
      outerType - The outer type
    • writeField

      public void writeField(org.objectweb.asm.ClassVisitor classVisitor, ObjectDef objectDef, FieldDef fieldDef)
      Write an enum.
      Parameters:
      classVisitor - The class visitor
      objectDef - The object definition
      fieldDef - 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 visitor
      interfaceDef - The interface definition
      outerType - The outer type
    • writeRecord

      public void writeRecord(org.objectweb.asm.ClassVisitor classVisitor, RecordDef recordDef)
      Write an interface.
      Parameters:
      classVisitor - The class visitor
      recordDef - 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 visitor
      recordDef - The record definition
      outerType - The outer type
    • writeClass

      public void writeClass(org.objectweb.asm.ClassVisitor classVisitor, ClassDef classDef)
      Write an interface.
      Parameters:
      classVisitor - The class visitor
      classDef - 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 visitor
      classDef - The class definition
      outerType - 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 visitor
      objectDef - The object definition
      methodDef - The method definition
    • write

      public byte[] write(ObjectDef objectDef)
      Writes the bytecode of generated class.
      Parameters:
      objectDef - The object definition.
      Returns:
      The bytes
    • write

      public byte[] write(ObjectDef objectDef, @Nullable @Nullable ClassTypeDef outerType)
      Writes the bytecode of generated class.
      Parameters:
      objectDef - The object definition.
      outerType - The outer type.
      Returns:
      The bytes