1
mirror of https://github.com/CarmJos/EasyPlugin.git synced 2024-09-19 19:25:45 +00:00

feat(storage): 为 StorageType 添加 DataStorage 泛型限制

This commit is contained in:
Carm Jos 2022-06-18 04:09:33 +08:00
parent 778235e8d1
commit 65bc24d1e9

View File

@ -4,15 +4,15 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public interface StorageType<K, V> {
public interface StorageType<K, T, S extends DataStorage<K, T>> {
int getID();
@NotNull List<String> getAlias();
@NotNull Class<? extends DataStorage<K, V>> getStorageClass();
@NotNull Class<? extends S> getStorageClass();
default @NotNull DataStorage<K, V> createStorage() throws Exception {
default @NotNull S createStorage() throws Exception {
return getStorageClass().newInstance();
}