improve wrapper and general structure #16
@ -40,11 +40,12 @@ public class InteractionRegistry {
|
|||||||
for (Method method : interactionHandler.getClass().getMethods()) {
|
for (Method method : interactionHandler.getClass().getMethods()) {
|
||||||
InteractionMethod iMethod = InteractionMethod.create(method, interactionHandler, marinara);
|
InteractionMethod iMethod = InteractionMethod.create(method, interactionHandler, marinara);
|
||||||
if (iMethod != null) {
|
if (iMethod != null) {
|
||||||
Optional<InteractionEntry> entry = this.interactions.stream().filter(iMethod::equals).findFirst();
|
Optional<InteractionEntry> oentry = this.interactions.stream()
|
||||||
if (entry.isEmpty()) {
|
.filter(i -> i.identifier().equals(iMethod.identifier()))
|
||||||
interactions.add(new InteractionEntry(iMethod.identifier()).addMethod(iMethod));
|
.findFirst();
|
||||||
}else
|
|
||||||
entry.get().addMethod(iMethod);
|
InteractionEntry entry = oentry.orElse(new InteractionEntry(iMethod.identifier())).addMethod(iMethod);
|
||||||
|
if (oentry.isEmpty()) this.interactions.add(entry);
|
||||||
logger.debug("Added {} method from {}", iMethod.method().getName(), interactionHandler.getClass().getSimpleName());
|
logger.debug("Added {} method from {}", iMethod.method().getName(), interactionHandler.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user