Skip to content

Commit 974c754

Browse files
authored
add module annotation (#59)
1 parent 43ab4a9 commit 974c754

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

simple-component/src/main/java/io/jbock/simple/Component.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
* implementation is to be generated. The generated class will
1212
* have the name of the type annotated, appended with {@code _Impl}. For
1313
* example, {@code @Component interface MyComponent {...}} will produce an implementation named
14-
* {@code MyComponent_Impl}.</p>
14+
* {@code MyComponent_Impl}.
1515
*
1616
* <h2>Component methods</h2>
1717
*
1818
* <p>Every type annotated with {@code @Component} must contain at least one abstract component
1919
* method. Component methods may have any name, but must have no parameters and return a bound type.
20-
* A bound type is one of the following:</p>
20+
* A bound type is one of the following:
2121
*
2222
* <ul>
2323
* <li>an {@link Inject injected} type
@@ -30,6 +30,12 @@
3030
@Retention(SOURCE)
3131
public @interface Component {
3232

33+
/**
34+
* A list of classes annotated with {@link Module} whose bindings are used to generate the
35+
* component implementation.
36+
*/
37+
Class<?>[] modules() default {};
38+
3339
/**
3440
* A factory for a component. Components <em>may</em> have a single nested {@code interface}
3541
* annotated with {@code @Component.Factory}.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.jbock.simple;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/** Annotates a class that contributes to the object graph. */
9+
@Retention(RetentionPolicy.RUNTIME)
10+
@Target(ElementType.TYPE)
11+
public @interface Module {
12+
}

0 commit comments

Comments
 (0)