chore: javadocs for annotations

This commit is contained in:
zaaarf 2023-03-16 10:56:46 +01:00
parent 062f8117b9
commit f85c868e10
No known key found for this signature in database
GPG key ID: AD8563472FD43386
5 changed files with 46 additions and 1 deletions

View file

@ -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 "";
}

View file

@ -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 {};
}

View file

@ -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 {};
}

View file

@ -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();
}

View file

@ -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;