Published: by Creative Commons Licence

  • Tags:


Byte Buddy is a code generation and manipulation library for creating and modifying Java classes during the runtime of a java application and without the help of a compiler.



New type

DynamicType.Unloaded<?> dynamicType = new ByteBuddy()


It's not necessary to name each class we created by byte-buddy, the default Byte Buddy configuration provides a NamingStrategy with randomly creates a class name based on a dynamic type's superclass name. The default behavior might not be convenient for you, and thanks to the convention over configuration principle, you can always alter the default behavior by your needs.

DynamicType.Unloaded<?> dynamicType = new ByteBuddy()
  .with(new NamingStrategy.AbstractBase() {
    public String subclass(TypeDescription superClass) {
        return "" + superClass.getSimpleName();