I am investigating com.sun.codemodel
to generate Java classes.
// https://mvnrepository.com/artifact/com.sun.codemodel/codemodel
compile group: 'com.sun.codemodel', name: 'codemodel', version: '2.6'
The JCodeModel class has multiple build methods that support generating the required Java classes to files, however I would like to obtain theses generated classes as Strings.
Looking at the Javadoc and source code of JCodeModel I cannot see anyway to achieve this.
How can I obtain my generated classes as a String instead of/as well as having them written to a file?
Is it possible to extend com.sun.codemodel.CodeWriter
to produce a String?