diff options
Diffstat (limited to 'src/main/java')
5 files changed, 46 insertions, 1 deletions
diff --git a/src/main/java/ftbsc/lll/processor/annotations/FindField.java b/src/main/java/ftbsc/lll/processor/annotations/FindField.java index c13fd46..40de173 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/FindField.java +++ b/src/main/java/ftbsc/lll/processor/annotations/FindField.java @@ -16,6 +16,16 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.CLASS) @java.lang.annotation.Target(ElementType.METHOD) public @interface FindField { + /** + * @return the {@link Class} object containing the desired field, + * or the {@link Object} class if not specified (the {@link Class} + * from {@link Patch#value()} is instead used) + */ Class<?> parent() default Object.class; + + /** + * @return the name of the field, will default to the empty string + * (the name of the annotated method will instead be used) + */ String name() default ""; } diff --git a/src/main/java/ftbsc/lll/processor/annotations/FindMethod.java b/src/main/java/ftbsc/lll/processor/annotations/FindMethod.java index 76fe560..1705619 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/FindMethod.java +++ b/src/main/java/ftbsc/lll/processor/annotations/FindMethod.java @@ -17,7 +17,23 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.CLASS) @java.lang.annotation.Target(ElementType.METHOD) public @interface FindMethod { + /** + * @return the {@link Class} object containing the desired method, + * or the {@link Object} class if not specified (the {@link Class} + * from {@link Patch#value()} is instead used) + */ Class<?> parent() default Object.class; + + /** + * @return the name of the method, will default to the empty string + * (the name of the annotated method will instead be used) + */ String name() default ""; + + /** + * @return a list of the parameters of the method, will default to empty + * array (in that case, an attempt will be made to match a method without + * args first) + */ Class<?>[] params() default {}; } diff --git a/src/main/java/ftbsc/lll/processor/annotations/Injector.java b/src/main/java/ftbsc/lll/processor/annotations/Injector.java index c26f704..4b74961 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/Injector.java +++ b/src/main/java/ftbsc/lll/processor/annotations/Injector.java @@ -11,6 +11,7 @@ import java.lang.annotation.RetentionPolicy; * as parameters. It will be discarded otherwise. * It will also be discarded unless the containing class is annotated with {@link Patch} * and another method within the class is annotated with {@link Target}. + * This annotation may be added multiple times, in order to target multiple methods. * @see Patch * @see Target */ @@ -18,6 +19,16 @@ import java.lang.annotation.RetentionPolicy; @Repeatable(MultipleInjectors.class) @java.lang.annotation.Target(ElementType.METHOD) public @interface Injector { + /** + * @return the name of the stub annotated with {@link Target} this is referring to. + * @since 0.3.0 + */ String targetName() default ""; + + /** + * @return the parameters of the stub annotated with {@link Target} this is referring + * to (used to discern in case of method stubs by the same name) + * @since 0.3.0 + */ Class<?>[] params() default {}; } diff --git a/src/main/java/ftbsc/lll/processor/annotations/MultipleInjectors.java b/src/main/java/ftbsc/lll/processor/annotations/MultipleInjectors.java index 5c6382e..8b4b3f8 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/MultipleInjectors.java +++ b/src/main/java/ftbsc/lll/processor/annotations/MultipleInjectors.java @@ -1,11 +1,19 @@ package ftbsc.lll.processor.annotations; import java.lang.annotation.ElementType; +import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +/** + * Used to support {@link Injector} as a {@link Repeatable} annotation. + * @since 0.3.0 + */ @Retention(RetentionPolicy.CLASS) @java.lang.annotation.Target(ElementType.METHOD) public @interface MultipleInjectors { + /** + * @return the {@link Injector} annotations, as an array + */ Injector[] value(); } diff --git a/src/main/java/ftbsc/lll/processor/annotations/Target.java b/src/main/java/ftbsc/lll/processor/annotations/Target.java index 99b8552..dbe7cf6 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/Target.java +++ b/src/main/java/ftbsc/lll/processor/annotations/Target.java @@ -22,7 +22,7 @@ public @interface Target { * and to only check parameters if further clarification is needed. * @implNote While non-strict mode is more computationally efficient, it's ultimately not * relevant, as it only matters at compile time. Do not set this to false unless - * you are sure know what you're doing. + * you know what you're doing. * @since 0.3.0 */ boolean strict() default true; |