Convert ModDependencies to an interface #15

Merged
owlsys merged 3 commits from TheKodeToad/mod-dependencies-iface into main 2024-09-02 12:09:57 -04:00
2 changed files with 34 additions and 10 deletions
Showing only changes of commit 730d8573a5 - Show all commits

View file

@ -2,6 +2,8 @@ package dev.frogmc.frogloader.api.mod;
import java.util.Collection;
import org.jetbrains.annotations.Nullable;
public interface ModDependencies {
/**
@ -42,17 +44,45 @@ public interface ModDependencies {
PROVIDE
}
kode marked this conversation as resolved Outdated

This class is missing javadocs

This class is missing javadocs
Outdated
Review

Added them, also hopefully added @Nullable on everything which can be null LMK if it's correct

Added them, also hopefully added @Nullable on everything which can be null LMK if it's correct
/**
* Represents a mod's dependency.
*/
interface Entry {
/**
* Get this dependency's type.
*
* @return This dependency's type.
*/
Type type();
/**
* Get this dependency's mod ID.
*
* @return This dependency's mod ID.
*/
String id();
String range();
/**
* Get this dependency's version range.
*
* @return This dependency's version range.
*/
@Nullable String range();
String link();
/**
* Get this dependency's installation link.
*
* @return This dependency's installation link.
*/
@Nullable String link();
String name();
/**
* Get this dependency's friendly name.
*
* @return This dependency's name.
*/
@Nullable String name();
}

View file

@ -2,14 +2,9 @@ package dev.frogmc.frogloader.impl.mod;
import java.util.*;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import dev.frogmc.frogloader.api.mod.ModDependencies;
import dev.frogmc.frogloader.api.mod.ModProperties;
import dev.frogmc.frogloader.api.mod.SemVer;
import dev.frogmc.frogloader.api.mod.ModDependencies.Entry;
import dev.frogmc.frogloader.api.mod.ModDependencies.Type;
/**
* A mod's dependencies.
@ -37,7 +32,6 @@ public final class ModDependenciesImpl implements ModDependencies {
* @param suggests <code>Type.SUGGEST</code> entries
* @param provides <code>Type.PROVIDE</code> entries
*/
@ApiStatus.Internal
public ModDependenciesImpl(Collection<ModDependencies.Entry> depends, Collection<ModDependencies.Entry> breaks, Collection<ModDependencies.Entry> suggests, Collection<ModDependencies.Entry> provides) {
entries.put(Type.DEPEND, depends);
entries.put(Type.BREAK, breaks);