-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of https://github.com/craftaro/SongodaCore …
…into development
- Loading branch information
Showing
68 changed files
with
900 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
Compatibility/src/main/java/com/craftaro/core/compatibility/MajorServerVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.craftaro.core.compatibility; | ||
|
||
import org.apache.commons.lang3.ArrayUtils; | ||
|
||
public enum MajorServerVersion { | ||
UNKNOWN, V1_7, V1_8, V1_9, V1_10, V1_11, V1_12, V1_13, V1_14, V1_15, V1_16, V1_17, V1_18, V1_19, V1_20, V1_21, V1_22, V1_23; | ||
|
||
private static final MajorServerVersion SERVER_VERSION = getVersion(); | ||
|
||
public boolean isLessThan(MajorServerVersion other) { | ||
if (SERVER_VERSION == UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return this.ordinal() < other.ordinal(); | ||
} | ||
|
||
public boolean isAtOrBelow(MajorServerVersion other) { | ||
if (SERVER_VERSION == UNKNOWN && other != UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return this.ordinal() <= other.ordinal(); | ||
} | ||
|
||
public boolean isGreaterThan(MajorServerVersion other) { | ||
if (SERVER_VERSION == UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return this.ordinal() > other.ordinal(); | ||
} | ||
|
||
public boolean isAtLeast(MajorServerVersion other) { | ||
if (SERVER_VERSION == UNKNOWN && other != UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return this.ordinal() >= other.ordinal(); | ||
} | ||
|
||
public static MajorServerVersion getServerVersion() { | ||
return SERVER_VERSION; | ||
} | ||
|
||
public static boolean isServerVersion(MajorServerVersion version) { | ||
return SERVER_VERSION == version; | ||
} | ||
|
||
public static boolean isServerVersion(MajorServerVersion... versions) { | ||
return ArrayUtils.contains(versions, SERVER_VERSION); | ||
} | ||
|
||
public static boolean isServerVersionAbove(MajorServerVersion version) { | ||
if (SERVER_VERSION == UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return SERVER_VERSION.ordinal() > version.ordinal(); | ||
} | ||
|
||
public static boolean isServerVersionAtLeast(MajorServerVersion version) { | ||
if (SERVER_VERSION == UNKNOWN && version != UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return SERVER_VERSION.ordinal() >= version.ordinal(); | ||
} | ||
|
||
public static boolean isServerVersionAtOrBelow(MajorServerVersion version) { | ||
if (SERVER_VERSION == UNKNOWN && version != UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return SERVER_VERSION.ordinal() <= version.ordinal(); | ||
} | ||
|
||
public static boolean isServerVersionBelow(MajorServerVersion version) { | ||
if (SERVER_VERSION == UNKNOWN) { | ||
return false; | ||
} | ||
|
||
return SERVER_VERSION.ordinal() < version.ordinal(); | ||
} | ||
|
||
private static MajorServerVersion getVersion() { | ||
for (MajorServerVersion version : values()) { | ||
if (ServerVersion.serverPackageVersion.toUpperCase().startsWith(version.name())) { | ||
return version; | ||
} | ||
} | ||
|
||
return UNKNOWN; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
Core/src/main/java/com/craftaro/core/core/LocaleModule.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.