summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/mapper/MapperProvider.java
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-09-01 12:09:26 +0200
committer zaaarf <zaaarf@proton.me>2023-09-01 12:09:26 +0200
commitfa6c73faf0ebdaac59a309f7c4bc114a3df99a24 (patch)
tree2fa03aa5e2be18e44725057e8288ef4007621d8f /src/main/java/ftbsc/lll/mapper/MapperProvider.java
parentea030e54b999aba4d8c3409c1507047f0a8aa8c5 (diff)
feat: rewrote the mapper api to make more sense
Diffstat (limited to 'src/main/java/ftbsc/lll/mapper/MapperProvider.java')
-rw-r--r--src/main/java/ftbsc/lll/mapper/MapperProvider.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/ftbsc/lll/mapper/MapperProvider.java b/src/main/java/ftbsc/lll/mapper/MapperProvider.java
index 07f3a28..ae7f760 100644
--- a/src/main/java/ftbsc/lll/mapper/MapperProvider.java
+++ b/src/main/java/ftbsc/lll/mapper/MapperProvider.java
@@ -12,7 +12,7 @@ import java.util.stream.Stream;
/**
* The main class of the mapper library. It loads all the
- * valid {@link IMapper}s and gets information from them.
+ * valid {@link IMappingFormat}s and gets information from them.
*/
public class MapperProvider {
/**
@@ -30,14 +30,14 @@ public class MapperProvider {
/**
* A {@link Set} containing all the loaded mapper classes.
*/
- private Set<Class<? extends IMapper>> loadedMappers = null;
+ private Set<Class<? extends IMappingFormat>> loadedMappers = null;
/**
* Loads the mapper classes into a {@link Set}.
*/
private void loadMappers() {
this.loadedMappers = new HashSet<>();
- for(IMapper mapper: ServiceLoader.load(IMapper.class))
+ for(IMappingFormat mapper: ServiceLoader.load(IMappingFormat.class))
this.loadedMappers.add(mapper.getClass());
if(this.loadedMappers.isEmpty())
throw new RuntimeException("Something went wrong: no mapper types were loaded successfully!");
@@ -48,9 +48,9 @@ public class MapperProvider {
* attempts to load the resource at given location and to populate a mapper with
* its data.
* @param data the file as a list of strings
- * @return a {@link IMapper} (populating it is left to the user)
+ * @return a {@link IMappingFormat} (populating it is left to the user)
*/
- public static IMapper getMapper(List<String> data) {
+ public static IMappingFormat getMapper(List<String> data) {
if(getInstance().loadedMappers == null)
getInstance().loadMappers();
return getInstance().loadedMappers.stream()
@@ -60,7 +60,7 @@ public class MapperProvider {
} catch(ReflectiveOperationException ignored) {}
return Stream.empty();
}).filter(m -> m.claim(data))
- .max(Comparator.comparingInt(IMapper::priority))
+ .max(Comparator.comparingInt(IMappingFormat::priority))
.orElseThrow(InvalidResourceException::new);
}