private List < Map < String , Object > > docForEnumArgument ( final Class < ? > enumClass ) { final ClassDoc doc = this . getDoclet ( ) . getClassDocForClass ( enumClass ) ; if ( doc == null ) { throw new RuntimeException ( "Tried to get docs for enum " + enumClass + " but got null instead" ) ; } final Set < String > enumConstantFieldNames = enumConstantsNames ( enumClass ) ; final List < Map < String , Object > > bindings = new ArrayList < Map < String , Object > > ( ) ; for ( final FieldDoc fieldDoc : doc . fields ( false ) ) { if ( enumConstantFieldNames . contains ( fieldDoc . name ( ) ) ) { bindings . add ( new HashMap < String , Object > ( ) { static final long serialVersionUID = 0L ; { put ( "name" , fieldDoc . name ( ) ) ; put ( "summary" , fieldDoc . commentText ( ) ) ; } } ) ; } } return bindings ; }
Helper routine that provides a FreeMarker map for an enumClass grabbing the values of the enum and their associated javadoc documentation .