replace jackson with gson

This commit is contained in:
jbb01
2024-04-01 18:06:45 +02:00
parent e8ace4fea5
commit 332c73f5fd
14 changed files with 498 additions and 124 deletions

View File

@@ -31,7 +31,7 @@ dependencies {
requireCapability("${project.group}:${project.name}-config")
}
}
implementation(libs.jackson.annotations)
implementation(libs.gson)
configApi(libs.annotations)
configCompileOnly(libs.lombok)

View File

@@ -1,25 +1,12 @@
package eu.jonahbauer.chat.bot.api;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.google.gson.annotations.SerializedName;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.time.LocalDateTime;
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
property = "type"
)
@JsonSubTypes({
@JsonSubTypes.Type(value = Message.Ping.class, name = "ping"),
@JsonSubTypes.Type(value = Message.Pong.class, name = "pong"),
@JsonSubTypes.Type(value = Message.Ack.class, name = "ack"),
@JsonSubTypes.Type(value = Message.Post.class, name = "post")
})
public sealed interface Message {
Ping PING = new Ping();
@@ -34,12 +21,11 @@ public sealed interface Message {
@NotNull String name,
@NotNull String message,
@NotNull String channel,
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@NotNull LocalDateTime date,
@Nullable Long delay,
@JsonProperty("user_id")
@SerializedName("user_id")
@Nullable Long userId,
@JsonProperty("username")
@SerializedName("username")
@Nullable String userName,
@NotNull String color,
int bottag

View File

@@ -7,7 +7,7 @@ module eu.jonahbauer.chat.bot.api {
requires transitive eu.jonahbauer.chat.bot.config;
requires static transitive org.jetbrains.annotations;
requires static com.fasterxml.jackson.annotation;
requires static com.google.gson;
requires static lombok;
uses ChatBot;