2929
3030import io .jooby .internal .apt .*;
3131
32+ /** Process jooby/jakarta annotation and generate source code from MVC controllers. */
3233@ SupportedOptions ({
3334 DEBUG ,
3435 INCREMENTAL ,
3940})
4041@ SupportedSourceVersion (SourceVersion .RELEASE_17 )
4142public class JoobyProcessor extends AbstractProcessor {
43+ /** Available options. */
4244 public interface Options {
45+ /** Run code generator in debug mode. */
4346 String DEBUG = "jooby.debug" ;
47+
48+ /** Add custom prefix to generated class. Default: none/empty */
4449 String ROUTER_PREFIX = "jooby.routerPrefix" ;
50+
51+ /** Add custom suffix to generated class. Default: _ */
4552 String ROUTER_SUFFIX = "jooby.routerSuffix" ;
53+
54+ /** Gradle options to run in incremental mode. */
4655 String INCREMENTAL = "jooby.incremental" ;
56+
57+ /** Turn on/off generation of method metadata. */
4758 String MVC_METHOD = "jooby.mvcMethod" ;
59+
60+ /** Control which annotations are translated to route attributes. */
4861 String SKIP_ATTRIBUTE_ANNOTATIONS = "jooby.skipAttributeAnnotations" ;
4962
63+ /**
64+ * Read a boolean option.
65+ *
66+ * @param environment Annotation processing environment.
67+ * @param option Option's name.
68+ * @param defaultValue Default value.
69+ * @return Option's value.
70+ */
5071 static boolean boolOpt (ProcessingEnvironment environment , String option , boolean defaultValue ) {
5172 return Boolean .parseBoolean (
5273 environment .getOptions ().getOrDefault (option , String .valueOf (defaultValue )));
5374 }
5475
76+ /**
77+ * Read a string list option.
78+ *
79+ * @param environment Annotation processing environment.
80+ * @param option Option's name.
81+ * @return Option's value.
82+ */
5583 static List <String > stringListOpt (ProcessingEnvironment environment , String option ) {
5684 String value = string (environment , option , null );
5785 return value == null || value .isEmpty ()
5886 ? List .of ()
5987 : Stream .of (value .split ("," )).filter (it -> !it .isBlank ()).map (String ::trim ).toList ();
6088 }
6189
90+ /**
91+ * Read a string option.
92+ *
93+ * @param environment Annotation processing environment.
94+ * @param option Option's name.
95+ * @param defaultValue Default value.
96+ * @return Option's value.
97+ */
6298 static String string (ProcessingEnvironment environment , String option , String defaultValue ) {
6399 String value = environment .getOptions ().getOrDefault (option , defaultValue );
64100 return value == null || value .isEmpty () ? defaultValue : value ;
@@ -68,10 +104,11 @@ static String string(ProcessingEnvironment environment, String option, String de
68104 protected MvcContext context ;
69105 private BiConsumer <Diagnostic .Kind , String > output ;
70106
71- public JoobyProcessor (BiConsumer <Diagnostic .Kind , String > output ) {
107+ JoobyProcessor (BiConsumer <Diagnostic .Kind , String > output ) {
72108 this .output = output ;
73109 }
74110
111+ /** Default constructor. */
75112 public JoobyProcessor () {}
76113
77114 @ Override
0 commit comments