Skip to content

Commit

Permalink
add module annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
h908714124 committed Dec 25, 2023
1 parent 43ab4a9 commit cf40dd2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 8 additions & 2 deletions simple-component/src/main/java/io/jbock/simple/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}.</p>
* {@code MyComponent_Impl}.
*
* <h2>Component methods</h2>
*
* <p>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:</p>
* A bound type is one of the following:
*
* <ul>
* <li>an {@link Inject injected} type
Expand All @@ -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 <em>may</em> have a single nested {@code interface}
* annotated with {@code @Component.Factory}.
Expand Down
12 changes: 12 additions & 0 deletions simple-component/src/main/java/io/jbock/simple/Module.java
Original file line number Diff line number Diff line change
@@ -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 {
}

0 comments on commit cf40dd2

Please sign in to comment.