From f087541fc11787fe31fff1b1365f109ca55b4eef Mon Sep 17 00:00:00 2001 From: Robert Gruber Date: Mon, 18 Mar 2024 10:53:45 +0000 Subject: [PATCH] Extract mongo version to interface --- core/src/main/java/de/bwaldvogel/mongo/MongoVersion.java | 6 +++++- core/src/main/java/de/bwaldvogel/mongo/ServerVersion.java | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/de/bwaldvogel/mongo/MongoVersion.java b/core/src/main/java/de/bwaldvogel/mongo/MongoVersion.java index 6ad3184c..a1cdb6e3 100644 --- a/core/src/main/java/de/bwaldvogel/mongo/MongoVersion.java +++ b/core/src/main/java/de/bwaldvogel/mongo/MongoVersion.java @@ -2,11 +2,15 @@ import java.util.List; +import de.bwaldvogel.mongo.backend.Utils; + public interface MongoVersion { List getVersionArray(); - String toVersionString(); + default String toVersionString() { + return Utils.join(getVersionArray(), "."); + } int getWireVersion(); diff --git a/core/src/main/java/de/bwaldvogel/mongo/ServerVersion.java b/core/src/main/java/de/bwaldvogel/mongo/ServerVersion.java index ae27d9f6..3c295d73 100644 --- a/core/src/main/java/de/bwaldvogel/mongo/ServerVersion.java +++ b/core/src/main/java/de/bwaldvogel/mongo/ServerVersion.java @@ -3,8 +3,6 @@ import java.util.Collections; import java.util.List; -import de.bwaldvogel.mongo.backend.Utils; - public enum ServerVersion implements MongoVersion { MONGO_3_6(List.of(3, 6, 0), 6); @@ -20,10 +18,6 @@ public List getVersionArray() { return Collections.unmodifiableList(versionArray); } - public String toVersionString() { - return Utils.join(versionArray, "."); - } - public int getWireVersion() { return wireVersion; }