setup ffsaf server

This commit is contained in:
2024-01-11 22:48:19 +01:00
commit 1d2d4626a5
34 changed files with 2323 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package fr.titionfire.ffsaf.utils;
import java.util.ResourceBundle;
public enum Categorie {
SUPER_MINI,
MINI_POUSSIN,
POUSSIN,
BENJAMIN,
MINIME,
CADET,
JUNIOR,
SENIOR1,
SENIOR2,
VETERAN1,
VETERAN2;
public String getName(ResourceBundle BUNDLE) {
return switch (this){
case SUPER_MINI -> BUNDLE.getString("Cat.SUPER_MINI");
case MINI_POUSSIN -> BUNDLE.getString("Cat.MINI_POUSSIN");
case POUSSIN -> BUNDLE.getString("Cat.POUSSIN");
case BENJAMIN -> BUNDLE.getString("Cat.BENJAMIN");
case MINIME -> BUNDLE.getString("Cat.MINIME");
case CADET -> BUNDLE.getString("Cat.CADET");
case JUNIOR -> BUNDLE.getString("Cat.JUNIOR");
case SENIOR1 -> BUNDLE.getString("Cat.SENIOR1");
case SENIOR2 -> BUNDLE.getString("Cat.SENIOR2");
case VETERAN1 -> BUNDLE.getString("Cat.VETERAN1");
case VETERAN2 -> BUNDLE.getString("Cat.VETERAN2");
};
}
}

View File

@@ -0,0 +1,5 @@
package fr.titionfire.ffsaf.utils;
public enum Genre {
H, F
}

View File

@@ -0,0 +1,28 @@
package fr.titionfire.ffsaf.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.TreeNode;
import java.util.function.Consumer;
import static fr.titionfire.ffsaf.net2.Client_Thread.MAPPER;
public class JsonConsumer<T> implements Consumer<T> {
private final Class<T> clazz;
private final Consumer<T> consumer;
public JsonConsumer(Class<T> clazz, Consumer<T> consumer){
this.clazz = clazz;
this.consumer = consumer;
}
public void castAndAccept (TreeNode message) throws JsonProcessingException {
this.accept(MAPPER.treeToValue(message, clazz));
}
@Override
public void accept(T t) {
consumer.accept(t);
}
}

View File

@@ -0,0 +1,15 @@
package fr.titionfire.ffsaf.utils;
import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@RegisterForReflection
public class Pair<K, V> {
private K key;
private V value;
}