public void generateEnums ( ) throws JClassAlreadyExistsException , IOException { final JCodeModel cm = new JCodeModel ( ) ; for ( final MetadataEnum metadataEnum : metadata . getEnumList ( ) ) { final String fqnEnum = metadataEnum . getPackageApi ( ) + "." + getPascalizeCase ( metadataEnum . getName ( ) ) ; final JDefinedClass dc = cm . _class ( fqnEnum , ClassType . ENUM ) ; final JDocComment javaDocComment = dc . javadoc ( ) ; final Map < String , String > part = javaDocComment . addXdoclet ( "author" ) ; part . put ( "<a href" , "'mailto:ralf.battenfeld@bluewin.ch'>Ralf Battenfeld</a>" ) ; for ( final String enumConstant : metadataEnum . getValueList ( ) ) { dc . enumConstant ( getEnumConstantName ( enumConstant ) ) ; } final JMethod toStringMethod = dc . method ( 1 , String . class , "toString" ) ; toStringMethod . body ( ) . _return ( JExpr . direct ( "name().substring(1)" ) ) ; } final File file = new File ( "./src/test/java" ) ; file . mkdirs ( ) ; cm . build ( file ) ; }
Generates all enumeration classes .