Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add module annotation #59

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
}
Loading