refactor(reflection): migrate to using cutin library
All checks were successful
github-mirror / push-github (push) Successful in 12s
Build / Gradle-Build (push) Successful in 15s
Test / Gradle-Test (push) Successful in 24s

This commit is contained in:
2025-04-13 23:15:38 +02:00
parent ebf5600e29
commit ef9384336a
47 changed files with 452 additions and 756 deletions

View File

@@ -4,9 +4,16 @@ import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.tomatentum.cutin.MethodParser;
import net.tomatentum.cutin.util.ReflectionUtil;
import net.tomatentum.marinara.interaction.annotation.AutoComplete;
public class AutocompleteParser implements AnnotationParser {
public class AutocompleteParser implements MethodParser {
private Logger logger = LoggerFactory.getLogger(getClass());
private Method method;
private Consumer<String[]> consumer;
@@ -21,13 +28,8 @@ public class AutocompleteParser implements AnnotationParser {
String[] autocompletes = Arrays.stream(this.method.getAnnotationsByType(AutoComplete.class))
.map(AutoComplete::value)
.toArray(String[]::new);
this.consumer.accept(autocompletes);
}
@Override
public Method getMethod() {
return this.method;
logger.trace("Parsed AutoComplete annotation {} for method {}", autocompletes, ReflectionUtil.getFullMethodName(method));
this.consumer.accept(autocompletes);
}
}