From cf40dd2027d79e91973b96967ca9b5a1bfe6ca60 Mon Sep 17 00:00:00 2001
From: jbock
Date: Mon, 25 Dec 2023 10:03:35 +0100
Subject: [PATCH] add module annotation
---
.../src/main/java/io/jbock/simple/Component.java | 10 ++++++++--
.../src/main/java/io/jbock/simple/Module.java | 12 ++++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
create mode 100644 simple-component/src/main/java/io/jbock/simple/Module.java
diff --git a/simple-component/src/main/java/io/jbock/simple/Component.java b/simple-component/src/main/java/io/jbock/simple/Component.java
index a72c739..b5980bd 100644
--- a/simple-component/src/main/java/io/jbock/simple/Component.java
+++ b/simple-component/src/main/java/io/jbock/simple/Component.java
@@ -11,13 +11,13 @@
* implementation is to be generated. The generated class will
* have the name of the type annotated, appended with {@code _Impl}. For
* example, {@code @Component interface MyComponent {...}} will produce an implementation named
- * {@code MyComponent_Impl}.
+ * {@code MyComponent_Impl}.
*
* Component methods
*
* Every type annotated with {@code @Component} must contain at least one abstract component
* method. Component methods may have any name, but must have no parameters and return a bound type.
- * A bound type is one of the following:
+ * A bound type is one of the following:
*
*
* - an {@link Inject injected} type
@@ -30,6 +30,12 @@
@Retention(SOURCE)
public @interface Component {
+ /**
+ * A list of classes annotated with {@link Module} whose bindings are used to generate the
+ * component implementation.
+ */
+ Class>[] modules() default {};
+
/**
* A factory for a component. Components may have a single nested {@code interface}
* annotated with {@code @Component.Factory}.
diff --git a/simple-component/src/main/java/io/jbock/simple/Module.java b/simple-component/src/main/java/io/jbock/simple/Module.java
new file mode 100644
index 0000000..a7dd8a4
--- /dev/null
+++ b/simple-component/src/main/java/io/jbock/simple/Module.java
@@ -0,0 +1,12 @@
+package io.jbock.simple;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** Annotates a class that contributes to the object graph. */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Module {
+}
\ No newline at end of file