6

Is there a any way to generate inner classes in javapoet library. I can generate classes with constructors and methods. But i can't figure out how to create inner classes

Damith
  • 1,982
  • 3
  • 28
  • 42

1 Answers1

7

Use the TypeSpec.Builder#addType method. See nestedClasses() test in TypeSpecTest.java

Sormuras
  • 8,491
  • 1
  • 38
  • 64