Skip to content

Commit 1f63e88

Browse files
authored
add getOption method (#92)
1 parent 4fd7024 commit 1f63e88

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

prism-core/src/main/java/io/avaje/prism/internal/APContextWriter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,16 @@ public static void write(PrintWriter out, String packageName, boolean moduleRead
322322
+ " return getCtx().typeUtils;\n"
323323
+ " }\n"
324324
+ "\n"
325+
+ "/**\n"
326+
+ " * Returns processor-specific option passed to the annotation processing tool.\n"
327+
+ " *\n"
328+
+ " * @param key the key of the processor option\n"
329+
+ " * @return an Optional for the processor option, or null if none is available.\n"
330+
+ " * @see {@link ProcessingEnvironment#getOptions()}\n"
331+
+ " */\n"
332+
+ " public static Optional<String> getOption(String key) {\n"
333+
+ " return Optional.ofNullable(processingEnv().getOptions().get(key));\n"
334+
+ " }\n"
325335
+ " /**\n"
326336
+ " * Determine whether the first type can be assigned to the second\n"
327337
+ " *\n"

0 commit comments

Comments
 (0)