diff options
Diffstat (limited to 'src/main/java/ftbsc/lll/processor/annotations')
5 files changed, 32 insertions, 5 deletions
diff --git a/src/main/java/ftbsc/lll/processor/annotations/FindField.java b/src/main/java/ftbsc/lll/processor/annotations/FindField.java index 9b5a824..c13fd46 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/FindField.java +++ b/src/main/java/ftbsc/lll/processor/annotations/FindField.java @@ -16,6 +16,6 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.CLASS) @java.lang.annotation.Target(ElementType.METHOD) public @interface FindField { - Class<?> parent(); + Class<?> parent() default Object.class; 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 bf93442..76fe560 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/FindMethod.java +++ b/src/main/java/ftbsc/lll/processor/annotations/FindMethod.java @@ -17,7 +17,7 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.CLASS) @java.lang.annotation.Target(ElementType.METHOD) public @interface FindMethod { - Class<?> parent(); + Class<?> parent() default Object.class; String name() default ""; - Class<?>[] params(); + 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 f5e22aa..c26f704 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/Injector.java +++ b/src/main/java/ftbsc/lll/processor/annotations/Injector.java @@ -1,6 +1,7 @@ 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; @@ -14,5 +15,9 @@ import java.lang.annotation.RetentionPolicy; * @see Target */ @Retention(RetentionPolicy.CLASS) +@Repeatable(MultipleInjectors.class) @java.lang.annotation.Target(ElementType.METHOD) -public @interface Injector {} +public @interface Injector { + String targetName() default ""; + 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 new file mode 100644 index 0000000..5c6382e --- /dev/null +++ b/src/main/java/ftbsc/lll/processor/annotations/MultipleInjectors.java @@ -0,0 +1,11 @@ +package ftbsc.lll.processor.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.CLASS) +@java.lang.annotation.Target(ElementType.METHOD) +public @interface MultipleInjectors { + 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 885bd9c..38477d1 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/Target.java +++ b/src/main/java/ftbsc/lll/processor/annotations/Target.java @@ -15,4 +15,15 @@ import java.lang.annotation.RetentionPolicy; */ @Retention(RetentionPolicy.CLASS) @java.lang.annotation.Target(ElementType.METHOD) -public @interface Target {} +public @interface Target { + + /** + * When set to false, tells the processor to first try to match a single method by name, + * 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 true unless + * you are sure know what you're doing. + * @since 0.3.0 + */ + boolean strict() default true; +} |