Can I use a single ByteBuddy instance to create multiple new class builders?

22 views
Skip to first unread message

Eric Haug

unread,
Nov 14, 2024, 8:44:48 AM11/14/24
to Byte Buddy

Examples located on the ByteBuddy website use anonymous object invocation (new ByteBuddy().subclass(Foo.class)) rather than assigning the ByteBuddy object to a field. Is this the recommended use for ByteBuddy, or should I assign the object to a field if I plan on creating many class builders?

I have an application that generates hundreds of dynamic classes. I was not sure if there would be any repercussions to using the same ByteBuddy object, or should I create a new object ByteBuddy object with each new class?

Rafael Winterhalter

unread,
Nov 14, 2024, 10:53:05 AM11/14/24
to Eric Haug, Byte Buddy

Everything in Byte Buddy is immutable and can be reused. Creating the instances is rather cheap, though, but it's up to you!


Eric Haug <erich...@gmail.com> schrieb am Do., 14. Nov. 2024, 14:44:

Examples located on the ByteBuddy website use anonymous object invocation (new ByteBuddy().subclass(Foo.class)) rather than assigning the ByteBuddy object to a field. Is this the recommended use for ByteBuddy, or should I assign the object to a field if I plan on creating many class builders?

I have an application that generates hundreds of dynamic classes. I was not sure if there would be any repercussions to using the same ByteBuddy object, or should I create a new object ByteBuddy object with each new class?

--
You received this message because you are subscribed to the Google Groups "Byte Buddy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to byte-buddy+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/byte-buddy/237119f3-9324-4074-b7e7-b33a2490d420n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages