remove ExceptionalConsumer

This commit is contained in:
dfsek committed 2021-07-18 10:00:48 -07:00
1 parent 3fecbe5d1d
commit d3a080127a
3 files changed
+6 -15

No files matched your search

@@ -1,20 +1,19 @@
package com.dfsek.terra.api.config;
import com.dfsek.tectonic.config.Configuration;
import com.dfsek.tectonic.exception.ConfigException;
import com.dfsek.terra.api.util.function.ExceptionalConsumer;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
public interface Loader {
Loader thenNames(ExceptionalConsumer<List<String>> consumer) throws ConfigException;
Loader thenNames(Consumer<List<String>> consumer) throws ConfigException;
Loader thenEntries(ExceptionalConsumer<Set<Map.Entry<String, InputStream>>> consumer) throws ConfigException;
Loader thenEntries(Consumer<Set<Map.Entry<String, InputStream>>> consumer) throws ConfigException;
/**
* Get a single file from this Loader.
@@ -1,8 +0,0 @@
package com.dfsek.terra.api.util.function;
import com.dfsek.tectonic.exception.ConfigException;
@FunctionalInterface
public interface ExceptionalConsumer<T> {
void accept(T t) throws ConfigException;
}
@@ -2,7 +2,6 @@ package com.dfsek.terra.config.fileloaders;
import com.dfsek.tectonic.exception.ConfigException;
import com.dfsek.terra.api.config.Loader;
import com.dfsek.terra.api.util.function.ExceptionalConsumer;
import java.io.IOException;
import java.io.InputStream;
@@ -11,18 +10,19 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
public abstract class LoaderImpl implements Loader {
protected final Map<String, InputStream> streams = new HashMap<>();
@Override
public Loader thenNames(ExceptionalConsumer<List<String>> consumer) throws ConfigException {
public Loader thenNames(Consumer<List<String>> consumer) throws ConfigException {
consumer.accept(new ArrayList<>(streams.keySet()));
return this;
}
@Override
public Loader thenEntries(ExceptionalConsumer<Set<Map.Entry<String, InputStream>>> consumer) throws ConfigException {
public Loader thenEntries(Consumer<Set<Map.Entry<String, InputStream>>> consumer) throws ConfigException {
consumer.accept(streams.entrySet());
return this;
}