diff --git a/common/api/core/src/main/java/com/dfsek/terra/api/config/ConfigPack.java b/common/api/core/src/main/java/com/dfsek/terra/api/config/ConfigPack.java index 261a2e6b4..c532c1c88 100644 --- a/common/api/core/src/main/java/com/dfsek/terra/api/config/ConfigPack.java +++ b/common/api/core/src/main/java/com/dfsek/terra/api/config/ConfigPack.java @@ -15,7 +15,6 @@ import java.util.Map; import com.dfsek.terra.api.addon.BaseAddon; import com.dfsek.terra.api.registry.CheckedRegistry; -import com.dfsek.terra.api.registry.meta.RegistryFactory; import com.dfsek.terra.api.registry.meta.RegistryHolder; import com.dfsek.terra.api.tectonic.LoaderHolder; import com.dfsek.terra.api.tectonic.LoaderRegistrar; diff --git a/common/api/registry/src/main/java/com/dfsek/terra/api/registry/meta/RegistryFactory.java b/common/api/registry/src/main/java/com/dfsek/terra/api/registry/meta/RegistryFactory.java deleted file mode 100644 index e87d35e9c..000000000 --- a/common/api/registry/src/main/java/com/dfsek/terra/api/registry/meta/RegistryFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra API is licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in the common/api directory. - */ - -package com.dfsek.terra.api.registry.meta; - -import com.dfsek.tectonic.api.loader.type.TypeLoader; - -import java.util.function.Function; - -import com.dfsek.terra.api.registry.OpenRegistry; - - -/** - * Helpers to avoid creating entire registry implementations for simple overrides. - */ -public interface RegistryFactory { - /** - * Create a generic OpenRegistry. - * - * @param Type of registry. - * - * @return New OpenRegistry - */ - OpenRegistry create(); - - /** - * Create an OpenRegistry with custom {@link TypeLoader} - * - * @param loader Function to create loader. - * @param Type of registry. - * - * @return New OpenRegistry. - */ - OpenRegistry create(Function, TypeLoader> loader); -} diff --git a/common/implementation/base/src/main/java/com/dfsek/terra/registry/RegistryFactoryImpl.java b/common/implementation/base/src/main/java/com/dfsek/terra/registry/RegistryFactoryImpl.java deleted file mode 100644 index ed6cc23e3..000000000 --- a/common/implementation/base/src/main/java/com/dfsek/terra/registry/RegistryFactoryImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of Terra. - * - * Terra is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Terra is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Terra. If not, see . - */ - -package com.dfsek.terra.registry; - -import com.dfsek.tectonic.api.exception.LoadException; -import com.dfsek.tectonic.api.loader.ConfigLoader; -import com.dfsek.tectonic.api.loader.type.TypeLoader; - -import java.lang.reflect.AnnotatedType; -import java.util.function.Function; - -import com.dfsek.terra.api.registry.OpenRegistry; -import com.dfsek.terra.api.registry.meta.RegistryFactory; -import com.dfsek.terra.api.util.generic.Lazy; - - -public class RegistryFactoryImpl implements RegistryFactory { - @Override - public OpenRegistry create() { - return new OpenRegistryImpl<>(); - } - - @Override - public OpenRegistry create(Function, TypeLoader> loader) { - return new OpenRegistryImpl<>() { - private final Lazy> loaderCache = Lazy.lazy(() -> loader.apply(this)); - - @Override - public T load(AnnotatedType type, Object o, ConfigLoader configLoader) throws LoadException { - return loaderCache.value().load(type, o, configLoader); - } - }; - } -}