Skip to content

Commit

Permalink
update javadoc of inject and provides (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
h908714124 authored Dec 24, 2023
1 parent 8ea35dd commit 43ab4a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion simple-component/src/main/java/io/jbock/simple/Inject.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Identifies injectable constructors and <em>static</em> methods.
* Identifies injectable constructors and {@code static} methods.
* An {@code @Inject}-annotated static method is allowed in the following places:
*
* <ul>
* <li>The method can be a direct child of the class or interface
* that defines its return type.
* <li>If the class or interface that defines its return type is nested
* inside an enclosing class, then the method may also be a direct child of the
* enclosing class.
* <li>The method can be a direct child of the component interface.
* Alternatively, the {@link Provides} annotation can be used in that case.
* </ul>
*/
@Target({METHOD, CONSTRUCTOR})
@Retention(RUNTIME)
Expand Down
4 changes: 2 additions & 2 deletions simple-component/src/main/java/io/jbock/simple/Provides.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import static java.lang.annotation.RetentionPolicy.SOURCE;

/**
* This is an alternative to the {@code @Inject} annotation
* which can only be used on static methods directly in the component.
* An alternative to the {@code @Inject} annotation that can be used
* on static methods which are direct children of the component interface.
*/
@Target(METHOD)
@Retention(SOURCE)
Expand Down

0 comments on commit 43ab4a9

Please sign in to comment.