Compare commits

..

No commits in common. "d0cbb096a85e605d23393377d970e1c2842fc784" and "3e50a065a3cf6eb5cfaa05ddd7689d362bf9059b" have entirely different histories.

7 changed files with 16 additions and 21 deletions

@ -20,6 +20,12 @@ dependencies {
testImplementation(libs.junit.jupiter) testImplementation(libs.junit.jupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// This dependency is exported to consumers, that is to say found on their compile classpath.
api(libs.commons.math3)
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation(libs.guava)
implementation(libs.log4j) implementation(libs.log4j)
} }

@ -1,24 +1,13 @@
package net.tomatentum.marinara; package net.tomatentum.marinara;
import java.lang.reflect.Constructor;
import net.tomatentum.marinara.registry.InteractionRegistry; import net.tomatentum.marinara.registry.InteractionRegistry;
import net.tomatentum.marinara.wrapper.LibraryWrapper; import net.tomatentum.marinara.wrapper.LibraryWrapper;
public class Marinara { public class Marinara {
public static <T extends LibraryWrapper> Marinara load(Class<T> clazz) { public static Marinara load(LibraryWrapper wrapper) {
try { InteractionRegistry registry = new InteractionRegistry(wrapper);
Constructor<T> ctor = clazz.getConstructor(); return new Marinara(registry);
ctor.setAccessible(true);
T wrapper = ctor.newInstance();
InteractionRegistry registry = new InteractionRegistry(wrapper);
return new Marinara(registry);
}catch (Exception ex) {
System.err.println(ex);
System.exit(100);
return null;
}
} }
private InteractionRegistry registry; private InteractionRegistry registry;

@ -0,0 +1,4 @@
package net.tomatentum.marinara.handler;
public interface InteractionHandler {
}

@ -1,4 +0,0 @@
package net.tomatentum.marinara.interaction;
public interface InteractionHandler {
}

@ -2,13 +2,13 @@ package net.tomatentum.marinara.interaction.methods;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import net.tomatentum.marinara.interaction.InteractionHandler;
import net.tomatentum.marinara.interaction.InteractionType; import net.tomatentum.marinara.interaction.InteractionType;
import net.tomatentum.marinara.interaction.commands.ExecutableCommandDefinition; import net.tomatentum.marinara.interaction.commands.ExecutableCommandDefinition;
import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand;
import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand;
import net.tomatentum.marinara.interaction.commands.annotation.SubCommandGroup; import net.tomatentum.marinara.interaction.commands.annotation.SubCommandGroup;
import net.tomatentum.marinara.util.ReflectionUtil; import net.tomatentum.marinara.util.ReflectionUtil;
import net.tomatentum.marinara.handler.InteractionHandler;
import net.tomatentum.marinara.wrapper.LibraryWrapper; import net.tomatentum.marinara.wrapper.LibraryWrapper;
public class CommandInteractionMethod extends InteractionMethod { public class CommandInteractionMethod extends InteractionMethod {

@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.tomatentum.marinara.interaction.InteractionHandler; import net.tomatentum.marinara.handler.InteractionHandler;
import net.tomatentum.marinara.interaction.InteractionType; import net.tomatentum.marinara.interaction.InteractionType;
import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand;
import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand;

@ -5,7 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import net.tomatentum.marinara.interaction.InteractionHandler; import net.tomatentum.marinara.handler.InteractionHandler;
import net.tomatentum.marinara.interaction.InteractionType; import net.tomatentum.marinara.interaction.InteractionType;
import net.tomatentum.marinara.interaction.commands.ApplicationCommandDefinition; import net.tomatentum.marinara.interaction.commands.ApplicationCommandDefinition;
import net.tomatentum.marinara.interaction.commands.ExecutableCommandDefinition; import net.tomatentum.marinara.interaction.commands.ExecutableCommandDefinition;