From 1f3c3df59d2d5556722fbfb2c70b1185879b06ea Mon Sep 17 00:00:00 2001 From: siujamo Date: Thu, 24 Jul 2025 14:18:31 +0800 Subject: [PATCH 01/13] chore: unify management of group and version --- build.gradle.kts | 7 +++++++ common-toolbox/build.gradle.kts | 3 --- crypto-toolbox/build.gradle.kts | 3 --- identity-generator/build.gradle.kts | 3 --- math-toolbox/build.gradle.kts | 3 --- tuple/build.gradle.kts | 3 --- version-catalogue/build.gradle.kts | 3 --- 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 533233b..cc56930 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,3 +19,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ + +val artefactVersion: String by project + +subprojects { + group = "com.onixbyte" + version = artefactVersion +} diff --git a/common-toolbox/build.gradle.kts b/common-toolbox/build.gradle.kts index 12d83a9..973cef2 100644 --- a/common-toolbox/build.gradle.kts +++ b/common-toolbox/build.gradle.kts @@ -35,9 +35,6 @@ val projectGithubUrl: String by project val licenseName: String by project val licenseUrl: String by project -group = "com.onixbyte" -version = artefactVersion - repositories { mavenCentral() } diff --git a/crypto-toolbox/build.gradle.kts b/crypto-toolbox/build.gradle.kts index 81139e1..72c9242 100644 --- a/crypto-toolbox/build.gradle.kts +++ b/crypto-toolbox/build.gradle.kts @@ -35,9 +35,6 @@ val projectGithubUrl: String by project val licenseName: String by project val licenseUrl: String by project -group = "com.onixbyte" -version = artefactVersion - repositories { mavenCentral() } diff --git a/identity-generator/build.gradle.kts b/identity-generator/build.gradle.kts index d3c7471..92cf544 100644 --- a/identity-generator/build.gradle.kts +++ b/identity-generator/build.gradle.kts @@ -35,9 +35,6 @@ val projectGithubUrl: String by project val licenseName: String by project val licenseUrl: String by project -group = "com.onixbyte" -version = artefactVersion - repositories { mavenCentral() } diff --git a/math-toolbox/build.gradle.kts b/math-toolbox/build.gradle.kts index 9226aa3..daba828 100644 --- a/math-toolbox/build.gradle.kts +++ b/math-toolbox/build.gradle.kts @@ -35,9 +35,6 @@ val projectGithubUrl: String by project val licenseName: String by project val licenseUrl: String by project -group = "com.onixbyte" -version = artefactVersion - repositories { mavenCentral() } diff --git a/tuple/build.gradle.kts b/tuple/build.gradle.kts index a9eb008..ca2a955 100644 --- a/tuple/build.gradle.kts +++ b/tuple/build.gradle.kts @@ -35,9 +35,6 @@ val projectGithubUrl: String by project val licenseName: String by project val licenseUrl: String by project -group = "com.onixbyte" -version = artefactVersion - repositories { mavenCentral() } diff --git a/version-catalogue/build.gradle.kts b/version-catalogue/build.gradle.kts index 5c440d3..ea4c522 100644 --- a/version-catalogue/build.gradle.kts +++ b/version-catalogue/build.gradle.kts @@ -34,9 +34,6 @@ val projectGithubUrl: String by project val licenseName: String by project val licenseUrl: String by project -group = "com.onixbyte" -version = artefactVersion - repositories { mavenCentral() } From 88c529e2632d09dd520d66d4fcb4c896c2e9f3a2 Mon Sep 17 00:00:00 2001 From: siujamo Date: Thu, 24 Jul 2025 14:27:32 +0800 Subject: [PATCH 02/13] style: unify code style --- .../impl/SnowflakeIdentityGenerator.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java b/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java index f3def6d..51bc9ab 100644 --- a/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java +++ b/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java @@ -154,18 +154,17 @@ public final class SnowflakeIdentityGenerator implements IdentityGenerator } // if generated at the same time, perform intra-millisecond sequences - long sequenceBits = 12L; + var sequenceBits = 12L; if (lastTimestamp == timestamp) { - long sequenceMask = ~(-1L << sequenceBits); + var sequenceMask = ~(-1L << sequenceBits); sequence = (sequence + 1) & sequenceMask; // sequence overflow in milliseconds if (sequence == 0) { // block to the next millisecond, get a new timestamp timestamp = awaitToNextMillis(lastTimestamp); } - } - // timestamp change, sequence reset in milliseconds - else { + } else { + // timestamp change, sequence reset in milliseconds sequence = 0L; } From 1166c6774afdb3393155ca316253f2cb05f0d209 Mon Sep 17 00:00:00 2001 From: siujamo Date: Thu, 24 Jul 2025 16:51:18 +0800 Subject: [PATCH 03/13] refactor: make data centre id bits and worker id as static final --- .../impl/SnowflakeIdentityGenerator.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java b/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java index 51bc9ab..4f4c152 100644 --- a/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java +++ b/identity-generator/src/main/java/com/onixbyte/identitygenerator/impl/SnowflakeIdentityGenerator.java @@ -29,9 +29,9 @@ import java.time.LocalDateTime; import java.time.ZoneId; /** - * The {@code SnowflakeIdentityGenerator} generates unique identifiers using the Snowflake algorithm, - * which combines a timestamp, worker ID, and data centre ID to create 64-bit long integers. The bit - * distribution for the generated IDs is as follows: + * The {@code SnowflakeIdentityGenerator} generates unique identifiers using the + * Snowflake algorithm, which combines a timestamp, worker ID, and data centre ID to create 64-bit + * long integers. The bit distribution for the generated IDs is as follows: *
    *
  • 1 bit for sign
  • *
  • 41 bits for timestamp (in milliseconds)
  • @@ -40,7 +40,7 @@ import java.time.ZoneId; *
  • 12 bits for sequence number (per millisecond)
  • *
*

- * When initializing a {@link SnowflakeIdentityGenerator}, you must provide the worker ID and data + * When initialising a {@link SnowflakeIdentityGenerator}, you must provide the worker ID and data * centre ID, ensuring they are within the valid range defined by the bit size. The generator * maintains an internal sequence number that increments for IDs generated within the * same millisecond. If the system clock moves backward, an exception is thrown to prevent @@ -63,15 +63,15 @@ public final class SnowflakeIdentityGenerator implements IdentityGenerator */ private final long startEpoch; - /** - * The number of bits reserved for the worker ID. - */ - private final long workerIdBits = 5L; - /** * The number of bits reserved for the data centre ID. */ - private final long dataCentreIdBits = 5L; + private static final long DATA_CENTRE_ID_BITS = 5L; + + /** + * The number of bits reserved for the worker ID. + */ + private static final long WORKER_ID_BITS = 5L; /** * The worker ID assigned to this generator. @@ -118,13 +118,13 @@ public final class SnowflakeIdentityGenerator implements IdentityGenerator throw new IllegalArgumentException("Start Epoch can not be greater than current timestamp!"); } - var maxWorkerId = ~(-1L << workerIdBits); + var maxWorkerId = ~(-1L << WORKER_ID_BITS); if (workerId > maxWorkerId || workerId < 0) { throw new IllegalArgumentException(String.format("Worker Id can't be greater than %d or less than 0", maxWorkerId)); } - var maxDataCentreId = ~(-1L << dataCentreIdBits); + var maxDataCentreId = ~(-1L << DATA_CENTRE_ID_BITS); if (dataCentreId > maxDataCentreId || dataCentreId < 0) { throw new IllegalArgumentException(String.format("Data Centre Id can't be greater than %d or less than 0", maxDataCentreId)); @@ -172,8 +172,8 @@ public final class SnowflakeIdentityGenerator implements IdentityGenerator lastTimestamp = timestamp; // shifted and put together by or operations to form a 64-bit ID - var timestampLeftShift = sequenceBits + workerIdBits + dataCentreIdBits; - var dataCentreIdShift = sequenceBits + workerIdBits; + var timestampLeftShift = sequenceBits + WORKER_ID_BITS + DATA_CENTRE_ID_BITS; + var dataCentreIdShift = sequenceBits + WORKER_ID_BITS; return ((timestamp - startEpoch) << timestampLeftShift) | (dataCentreId << dataCentreIdShift) | (workerId << sequenceBits) From ab6b3206a949380a7ecc09cb63baba577c0a7b9a Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 21:01:48 +0800 Subject: [PATCH 04/13] refactor: rename `TriTuple` to `Triple` --- ...ableTriTuple.java => ImmutableTriple.java} | 10 +++--- .../tuple/{TriTuple.java => Triple.java} | 32 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) rename tuple/src/main/java/com/onixbyte/tuple/{ImmutableTriTuple.java => ImmutableTriple.java} (82%) rename tuple/src/main/java/com/onixbyte/tuple/{TriTuple.java => Triple.java} (76%) diff --git a/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriTuple.java b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java similarity index 82% rename from tuple/src/main/java/com/onixbyte/tuple/ImmutableTriTuple.java rename to tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java index 1db986b..20dda6d 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriTuple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java @@ -34,14 +34,14 @@ package com.onixbyte.tuple; * @author siujamo * @author zihluwang */ -public record ImmutableTriTuple( +public record ImmutableTriple( L left, M middle, R right ) { /** - * Creates a new {@code ImmutableTriTuple} with the specified left, middle, and right elements. + * Creates a new {@code ImmutableTriple} with the specified left, middle, and right elements. * * @param the type of the left element * @param the type of the middle element @@ -49,9 +49,9 @@ public record ImmutableTriTuple( * @param left the left element * @param middle the middle element * @param right the right element - * @return a new {@code ImmutableTriTuple} containing the specified elements + * @return a new {@code ImmutableTriple} containing the specified elements */ - public static ImmutableTriTuple of(L left, M middle, R right) { - return new ImmutableTriTuple<>(left, middle, right); + public static ImmutableTriple of(L left, M middle, R right) { + return new ImmutableTriple<>(left, middle, right); } } diff --git a/tuple/src/main/java/com/onixbyte/tuple/TriTuple.java b/tuple/src/main/java/com/onixbyte/tuple/Triple.java similarity index 76% rename from tuple/src/main/java/com/onixbyte/tuple/TriTuple.java rename to tuple/src/main/java/com/onixbyte/tuple/Triple.java index 3f0ffe1..77d67ad 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/TriTuple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/Triple.java @@ -32,7 +32,7 @@ import java.util.Objects; * @author siujamo * @author zihluwang */ -public final class TriTuple { +public final class Triple { /** * The left element of the triple. @@ -50,13 +50,13 @@ public final class TriTuple { private R right; /** - * Constructs a new {@code TriTuple} with the given left, middle and right elements. + * Constructs a new {@code Triple} with the given left, middle and right elements. * * @param left the left element * @param middle the middle element * @param right the right element */ - public TriTuple(L left, M middle, R right) { + public Triple(L left, M middle, R right) { this.left = left; this.middle = middle; this.right = right; @@ -117,22 +117,22 @@ public final class TriTuple { } /** - * Checks if this {@code TriTuple} is equal to the specified object. - * Two {@code TriTuple}s are considered equal if their left, middle and right elements are equal. + * Checks if this {@code Triple} is equal to the specified object. + * Two {@code Triple}s are considered equal if their left, middle and right elements are equal. * * @param object the object to compare with * @return {@code true} if the objects are equal, {@code false} otherwise */ @Override public boolean equals(Object object) { - if (!(object instanceof TriTuple triTuple)) return false; - return Objects.equals(left, triTuple.left) && - Objects.equals(middle, triTuple.middle) && - Objects.equals(right, triTuple.right); + if (!(object instanceof Triple triple)) return false; + return Objects.equals(left, triple.left) && + Objects.equals(middle, triple.middle) && + Objects.equals(right, triple.right); } /** - * Calculates the hash code for this {@code TriTuple} based on its left, middle and right elements. + * Calculates the hash code for this {@code Triple} based on its left, middle and right elements. * * @return the hash code value for this object */ @@ -142,13 +142,13 @@ public final class TriTuple { } /** - * Returns a string representation of this {@code TriTuple}, including its left, middle and right elements. + * Returns a string representation of this {@code Triple}, including its left, middle and right elements. * * @return a string representation of the object */ @Override public String toString() { - return "TriTuple{" + + return "Triple{" + "left=" + left + ", middle=" + middle + ", right=" + right + @@ -156,7 +156,7 @@ public final class TriTuple { } /** - * Factory method to create a new {@code TriTuple} instance with the given left, middle and right elements. + * Factory method to create a new {@code Triple} instance with the given left, middle and right elements. * * @param left the left element * @param middle the middle element @@ -164,9 +164,9 @@ public final class TriTuple { * @param the type of the left element * @param the type of the middle element * @param the type of the right element - * @return a new {@code TriTuple} instance + * @return a new {@code Triple} instance */ - public static TriTuple of(L left, M middle, R right) { - return new TriTuple<>(left, middle, right); + public static Triple of(L left, M middle, R right) { + return new Triple<>(left, middle, right); } } From 8a1a09bef81d6dbe6b8514f6284e31ec1872231a Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 21:11:34 +0800 Subject: [PATCH 05/13] style: update code style remove javadoc of private fields --- .../main/java/com/onixbyte/tuple/Triple.java | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/tuple/src/main/java/com/onixbyte/tuple/Triple.java b/tuple/src/main/java/com/onixbyte/tuple/Triple.java index 77d67ad..60c2e5b 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/Triple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/Triple.java @@ -34,19 +34,8 @@ import java.util.Objects; */ public final class Triple { - /** - * The left element of the triple. - */ private L left; - - /** - * The middle element of the triple. - */ private M middle; - - /** - * The right element of the triple. - */ private R right; /** @@ -117,8 +106,8 @@ public final class Triple { } /** - * Checks if this {@code Triple} is equal to the specified object. - * Two {@code Triple}s are considered equal if their left, middle and right elements are equal. + * Checks if this {@code Triple} is equal to the specified object. Two {@code Triple}s are + * considered equal if their left, middle and right elements are equal. * * @param object the object to compare with * @return {@code true} if the objects are equal, {@code false} otherwise @@ -132,7 +121,8 @@ public final class Triple { } /** - * Calculates the hash code for this {@code Triple} based on its left, middle and right elements. + * Calculates the hash code for this {@code Triple} based on its left, middle and + * right elements. * * @return the hash code value for this object */ @@ -142,7 +132,8 @@ public final class Triple { } /** - * Returns a string representation of this {@code Triple}, including its left, middle and right elements. + * Returns a string representation of this {@code Triple}, including its left, middle and + * right elements. * * @return a string representation of the object */ From 93589495c35c65bdadc9660f74449114a19f4941 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 21:14:22 +0800 Subject: [PATCH 06/13] refactor: rename `BiTuple` to `Tuple` --- .../com/onixbyte/tuple/ImmutableBiTuple.java | 52 ----------------- .../com/onixbyte/tuple/ImmutableTuple.java | 57 +++++++++++++++++++ .../tuple/{BiTuple.java => Tuple.java} | 38 ++++++------- 3 files changed, 76 insertions(+), 71 deletions(-) delete mode 100644 tuple/src/main/java/com/onixbyte/tuple/ImmutableBiTuple.java create mode 100644 tuple/src/main/java/com/onixbyte/tuple/ImmutableTuple.java rename tuple/src/main/java/com/onixbyte/tuple/{BiTuple.java => Tuple.java} (73%) diff --git a/tuple/src/main/java/com/onixbyte/tuple/ImmutableBiTuple.java b/tuple/src/main/java/com/onixbyte/tuple/ImmutableBiTuple.java deleted file mode 100644 index 48b38b3..0000000 --- a/tuple/src/main/java/com/onixbyte/tuple/ImmutableBiTuple.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2024-2025 OnixByte. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.onixbyte.tuple; - -/** - * Represents an immutable pair of two elements, referred to as 'left' and 'right'. This class - * provides a simple way to group two values without the need to create a custom class for each - * specific pair. - *

- * The generic types {@code L} and {@code R} denote the types of the left and right elements, - * respectively. Instances of this class are immutable once created. - * - * @param the type of the left element - * @param the type of the right element - * @param left the left element of this tuple - * @param right the right element of this tuple - * @author siujamo - * @author zihluwang - */ -public record ImmutableBiTuple( - L left, - R right -) { - - /** - * Creates a new {@code ImmutableBiTuple} with the specified left and right elements. - * - * @param the type of the left element - * @param the type of the right element - * @param left the left element - * @param right the right element - * @return a new {@code ImmutableBiTuple} containing the specified elements - */ - public static ImmutableBiTuple of(L left, R right) { - return new ImmutableBiTuple<>(left, right); - } -} diff --git a/tuple/src/main/java/com/onixbyte/tuple/ImmutableTuple.java b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTuple.java new file mode 100644 index 0000000..f74451d --- /dev/null +++ b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTuple.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024-2025 OnixByte + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.onixbyte.tuple; + +/** + * Represents an immutable pair of two elements, referred to as 'left' and 'right'. This class + * provides a simple way to group two values without the need to create a custom class for each + * specific pair. + *

+ * The generic types {@code L} and {@code R} denote the types of the left and right elements, + * respectively. Instances of this class are immutable once created. + * + * @param the type of the left element + * @param the type of the right element + * @param left the left element of this tuple + * @param right the right element of this tuple + * @author siujamo + * @author zihluwang + */ +public record ImmutableTuple( + L left, + R right +) { + + /** + * Creates a new {@code ImmutableTuple} with the specified left and right elements. + * + * @param the type of the left element + * @param the type of the right element + * @param left the left element + * @param right the right element + * @return a new {@code ImmutableTuple} containing the specified elements + */ + public static ImmutableTuple of(L left, R right) { + return new ImmutableTuple<>(left, right); + } +} diff --git a/tuple/src/main/java/com/onixbyte/tuple/BiTuple.java b/tuple/src/main/java/com/onixbyte/tuple/Tuple.java similarity index 73% rename from tuple/src/main/java/com/onixbyte/tuple/BiTuple.java rename to tuple/src/main/java/com/onixbyte/tuple/Tuple.java index 6c7e8ff..6b2e613 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/BiTuple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/Tuple.java @@ -33,7 +33,7 @@ import java.util.Objects; * @author siujamo * @author zihluwang */ -public final class BiTuple { +public final class Tuple { /** * The left element of the tuple. @@ -46,12 +46,12 @@ public final class BiTuple { private R right; /** - * Constructs a new {@code BiTuple} with the specified left and right elements. + * Constructs a new {@code Tuple} with the specified left and right elements. * * @param left the left element to be stored in the tuple * @param right the right element to be stored in the tuple */ - public BiTuple(L left, R right) { + public Tuple(L left, R right) { this.left = left; this.right = right; } @@ -93,27 +93,27 @@ public final class BiTuple { } /** - * Compares this {@code BiTuple} with the specified object for equality. + * Compares this {@code Tuple} with the specified object for equality. *

- * Two {@code BiTuple}s are considered equal if they are of the same type and their left and + * Two {@code Tuple}s are considered equal if they are of the same type and their left and * right elements are equal according to their respective {@code equals} methods. * - * @param object the object to compare with this {@code BiTuple} - * @return {@code true} if the specified object is equal to this {@code BiTuple}, + * @param object the object to compare with this {@code Tuple} + * @return {@code true} if the specified object is equal to this {@code Tuple}, * {@code false} otherwise */ @Override public boolean equals(Object object) { - if (!(object instanceof BiTuple biTuple)) return false; - return Objects.equals(left, biTuple.left) && Objects.equals(right, biTuple.right); + if (!(object instanceof Tuple tuple)) return false; + return Objects.equals(left, tuple.left) && Objects.equals(right, tuple.right); } /** - * Returns a hash code value for the {@code BiTuple}. + * Returns a hash code value for the {@code Tuple}. *

* The hash code is calculated based on the hash codes of the left and right elements. * - * @return a hash code value for this {@code BiTuple} + * @return a hash code value for this {@code Tuple} */ @Override public int hashCode() { @@ -121,31 +121,31 @@ public final class BiTuple { } /** - * Returns a string representation of the {@code BiTuple}. + * Returns a string representation of the {@code Tuple}. *

* The string representation consists of the class name, followed by the values of - * the left and right elements in the format {@code "BiTuple{left=value1, right=value2}"}. + * the left and right elements in the format {@code "Tuple{left=value1, right=value2}"}. * - * @return a string representation of the {@code BiTuple} + * @return a string representation of the {@code Tuple} */ @Override public String toString() { - return "BiTuple{" + + return "Tuple{" + "left=" + left + ", right=" + right + '}'; } /** - * Creates a new {@code BiTuple} with the specified left and right elements. + * Creates a new {@code Tuple} with the specified left and right elements. * * @param the type of the left element * @param the type of the right element * @param left the left element * @param right the right element - * @return a new {@code BiTuple} containing the specified elements + * @return a new {@code Tuple} containing the specified elements */ - public static BiTuple of(L left, R right) { - return new BiTuple<>(left, right); + public static Tuple of(L left, R right) { + return new Tuple<>(left, right); } } From 9c79efd520adf9d1f67fb2f749e76cccc1078b9a Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 21:14:57 +0800 Subject: [PATCH 07/13] docs: remove javadoc of private fields --- tuple/src/main/java/com/onixbyte/tuple/Tuple.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tuple/src/main/java/com/onixbyte/tuple/Tuple.java b/tuple/src/main/java/com/onixbyte/tuple/Tuple.java index 6b2e613..53b1bcc 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/Tuple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/Tuple.java @@ -35,14 +35,7 @@ import java.util.Objects; */ public final class Tuple { - /** - * The left element of the tuple. - */ private L left; - - /** - * The right element of the tuple. - */ private R right; /** From 342e728647a4143213bfacca293843045bd09909 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 21:15:19 +0800 Subject: [PATCH 08/13] docs: upgrade copyright header --- .../com/onixbyte/tuple/ImmutableTriple.java | 27 +++++++++++-------- .../main/java/com/onixbyte/tuple/Triple.java | 27 +++++++++++-------- .../main/java/com/onixbyte/tuple/Tuple.java | 27 +++++++++++-------- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java index 20dda6d..56d90d3 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java @@ -1,18 +1,23 @@ /* - * Copyright (C) 2024-2025 OnixByte. + * Copyright (c) 2024-2025 OnixByte * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ package com.onixbyte.tuple; diff --git a/tuple/src/main/java/com/onixbyte/tuple/Triple.java b/tuple/src/main/java/com/onixbyte/tuple/Triple.java index 60c2e5b..95e8774 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/Triple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/Triple.java @@ -1,18 +1,23 @@ /* - * Copyright (C) 2024-2025 OnixByte. + * Copyright (c) 2024-2025 OnixByte * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ package com.onixbyte.tuple; diff --git a/tuple/src/main/java/com/onixbyte/tuple/Tuple.java b/tuple/src/main/java/com/onixbyte/tuple/Tuple.java index 53b1bcc..cba5ff6 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/Tuple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/Tuple.java @@ -1,18 +1,23 @@ /* - * Copyright (C) 2024-2025 OnixByte. + * Copyright (c) 2024-2025 OnixByte * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ package com.onixbyte.tuple; From dbab844c75a339f7fe059bb7b143b7ab41bddb5e Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 21:40:18 +0800 Subject: [PATCH 09/13] style: adjust project sequence and `include` command in gradle This commit provides IDE with convienience for code generations --- settings.gradle.kts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 415ef24..7caa844 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,12 +17,9 @@ rootProject.name = "onixbyte-toolbox" -include( - "version-catalogue", - "common-toolbox", - "identity-generator", - "crypto-toolbox", - "math-toolbox", -) - -include("tuple") \ No newline at end of file +include("version-catalogue") +include("common-toolbox") +include("tuple") +include("identity-generator") +include("crypto-toolbox") +include("math-toolbox") From d67927ba67ae8ae94c16bba5375797ff11ccdfdd Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 22:10:45 +0800 Subject: [PATCH 10/13] docs: update copyright header --- settings.gradle.kts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 7caa844..92c83e6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,18 +1,23 @@ /* - * Copyright (C) 2024-2025 OnixByte. + * Copyright (c) 2024-2025 OnixByte * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ rootProject.name = "onixbyte-toolbox" From 06594e1b7768c718685c3006f5375361c8a1b1da Mon Sep 17 00:00:00 2001 From: zihluwang Date: Fri, 12 Sep 2025 21:52:32 +0800 Subject: [PATCH 11/13] feat: rename `ChainedCalcUtil` to `Calculator` --- gradle.properties | 2 +- .../{ChainedCalcUtil.java => Calculator.java} | 91 ++++++++++--------- 2 files changed, 50 insertions(+), 43 deletions(-) rename math-toolbox/src/main/java/com/onixbyte/math/{ChainedCalcUtil.java => Calculator.java} (82%) diff --git a/gradle.properties b/gradle.properties index 3c0b678..6dcdc54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ # SOFTWARE. # -artefactVersion=3.2.0 +artefactVersion=3.3.0 projectUrl=https://onixbyte.com/projects/onixbyte-toolbox projectGithubUrl=https://github.com/onixbyte/onixbyte-toolbox licenseName=MIT diff --git a/math-toolbox/src/main/java/com/onixbyte/math/ChainedCalcUtil.java b/math-toolbox/src/main/java/com/onixbyte/math/Calculator.java similarity index 82% rename from math-toolbox/src/main/java/com/onixbyte/math/ChainedCalcUtil.java rename to math-toolbox/src/main/java/com/onixbyte/math/Calculator.java index 51d31fd..ef692a4 100644 --- a/math-toolbox/src/main/java/com/onixbyte/math/ChainedCalcUtil.java +++ b/math-toolbox/src/main/java/com/onixbyte/math/Calculator.java @@ -38,45 +38,45 @@ import java.util.function.Function; * Usage: *

  *  // Perform addition: 3 + 4
- *  BigDecimal result1 = ChainedCalcUtil.startWith(3)
+ *  BigDecimal result1 = Calculator.startWith(3)
  *                                      .add(4)
  *                                      .getValue();
  *
  *  // Perform subtraction: 4 - 2
- *  BigDecimal result2 = ChainedCalcUtil.startWith(4)
+ *  BigDecimal result2 = Calculator.startWith(4)
  *                                      .subtract(2)
  *                                      .getValue();
  *
  *  // Perform multiplication: 3 * 6
- *  BigDecimal result3 = ChainedCalcUtil.startWith(3)
+ *  BigDecimal result3 = Calculator.startWith(3)
  *                                      .multiply(6)
  *                                      .getValue();
  *
  *  // Perform division: 6 ÷ 2
- *  BigDecimal result4 = ChainedCalcUtil.startWith(6)
+ *  BigDecimal result4 = Calculator.startWith(6)
  *                                      .divide(2)
  *                                      .getValue();
  *
  *  // Perform division with specified scale: 13 ÷ 7 with a scale of 2
- *  BigDecimal result5 = ChainedCalcUtil.startWith(13)
+ *  BigDecimal result5 = Calculator.startWith(13)
  *                                      .divideWithScale(7, 2)
  *                                      .getValue();
  *
  *  // Get int, long, or double results
- *  int intResult = ChainedCalcUtil.startWith(3)
+ *  int intResult = Calculator.startWith(3)
  *                                .add(4)
  *                                .getInteger();
  *
- *  long longResult = ChainedCalcUtil.startWith(4)
+ *  long longResult = Calculator.startWith(4)
  *                                  .subtract(2)
  *                                  .getLong();
  *
- *  double doubleResult = ChainedCalcUtil.startWith(6)
+ *  double doubleResult = Calculator.startWith(6)
  *                                      .divide(2)
  *                                      .getDouble();
  *
  *  // Get BigDecimal result with specified scale
- *  BigDecimal result6 = ChainedCalcUtil.startWith(13)
+ *  BigDecimal result6 = Calculator.startWith(13)
  *                                      .divide(7)
  *                                      .getValue(2);
  *  
@@ -89,18 +89,18 @@ import java.util.function.Function; * and may have performance implications for extremely large numbers or complex calculations. * * @author sunzsh - * @version 3.0.0 + * @version 3.3.0 * @see BigDecimal * @since 1.0.0 */ -public final class ChainedCalcUtil { +public final class Calculator { /** * Creates a {@code ChainedCalcUtil} instance with the specified initial value. * * @param value the initial value for the calculation */ - private ChainedCalcUtil(Number value) { + private Calculator(Number value) { this.value = convertBigDecimal(value, null); } @@ -110,8 +110,8 @@ public final class ChainedCalcUtil { * @param value the initial value for the calculation * @return a {@code ChainedCalcUtil} instance for performing chained calculations */ - public static ChainedCalcUtil startWith(Number value) { - return new ChainedCalcUtil(value); + public static Calculator startWith(Number value) { + return new Calculator(value); } /** @@ -120,7 +120,7 @@ public final class ChainedCalcUtil { * @param other the value to be added * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil add(Number other) { + public Calculator add(Number other) { return operator(BigDecimal::add, other); } @@ -131,7 +131,7 @@ public final class ChainedCalcUtil { * @param beforeOperateScale the scale to be applied before the operation * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil add(Number other, Integer beforeOperateScale) { + public Calculator add(Number other, Integer beforeOperateScale) { return operator(BigDecimal::add, other, beforeOperateScale); } @@ -141,7 +141,7 @@ public final class ChainedCalcUtil { * @param other the value to be subtracted * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil subtract(Number other) { + public Calculator subtract(Number other) { return operator(BigDecimal::subtract, other); } @@ -153,7 +153,7 @@ public final class ChainedCalcUtil { * @param beforeOperateScale the scale to be applied before the operation * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil subtract(Number other, Integer beforeOperateScale) { + public Calculator subtract(Number other, Integer beforeOperateScale) { return operator(BigDecimal::subtract, other, beforeOperateScale); } @@ -163,7 +163,7 @@ public final class ChainedCalcUtil { * @param other the value to be multiplied by * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil multiply(Number other) { + public Calculator multiply(Number other) { return operator(BigDecimal::multiply, other); } @@ -175,7 +175,7 @@ public final class ChainedCalcUtil { * @param beforeOperateScale the scale to be applied before the operation * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil multiply(Number other, Integer beforeOperateScale) { + public Calculator multiply(Number other, Integer beforeOperateScale) { return operator(BigDecimal::multiply, other, beforeOperateScale); } @@ -185,7 +185,7 @@ public final class ChainedCalcUtil { * @param other the value to divide by * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil divide(Number other) { + public Calculator divide(Number other) { return operator(BigDecimal::divide, other); } @@ -196,7 +196,7 @@ public final class ChainedCalcUtil { * @param beforeOperateScale the scale to be applied before the operation * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil divide(Number other, Integer beforeOperateScale) { + public Calculator divide(Number other, Integer beforeOperateScale) { return operator(BigDecimal::divide, other, beforeOperateScale); } @@ -207,9 +207,9 @@ public final class ChainedCalcUtil { * @param scale the scale for the result * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil divideWithScale(Number other, Integer scale) { + public Calculator divideWithScale(Number other, Integer scale) { return baseOperator(otherValue -> - this.value.divide(otherValue, scale, RoundingMode.HALF_UP), other, null); + this.value.divide(otherValue, scale, RoundingMode.HALF_UP), other, null); } /** @@ -221,10 +221,10 @@ public final class ChainedCalcUtil { * @param beforeOperateScale the scale to be applied before the operation * @return a {@code ChainedCalcUtil} instance with the updated value */ - public ChainedCalcUtil divideWithScale(Number other, Integer scale, Integer beforeOperateScale) { + public Calculator divideWithScale(Number other, Integer scale, Integer beforeOperateScale) { return baseOperator((otherValue) -> - this.value.divide(otherValue, scale, RoundingMode.HALF_UP), - other, beforeOperateScale); + this.value.divide(otherValue, scale, RoundingMode.HALF_UP), + other, beforeOperateScale); } /** @@ -290,7 +290,10 @@ public final class ChainedCalcUtil { * @param otherValue the value to apply the operator with * @return a ChainedCalcUtil instance with the updated value */ - private ChainedCalcUtil operator(BiFunction operator, Object otherValue) { + private Calculator operator( + BiFunction operator, + Object otherValue + ) { return operator(operator, otherValue, 9); } @@ -304,13 +307,16 @@ public final class ChainedCalcUtil { * or null if not applicable * @return a ChainedCalcUtil instance with the updated value */ - private ChainedCalcUtil operator(BiFunction operator, - Object other, - Integer beforeOperateScale) { - return baseOperator((otherValue) -> - operator.apply(this.value, otherValue), - other, - beforeOperateScale); + private Calculator operator( + BiFunction operator, + Object other, + Integer beforeOperateScale + ) { + return baseOperator( + (otherValue) -> operator.apply(this.value, otherValue), + other, + beforeOperateScale + ); } /** @@ -323,14 +329,16 @@ public final class ChainedCalcUtil { * or null if not applicable * @return a ChainedCalcUtil instance with the updated value */ - private synchronized ChainedCalcUtil baseOperator(Function operatorFunction, - Object anotherValue, - Integer beforeOperateScale) { + private synchronized Calculator baseOperator( + Function operatorFunction, + Object anotherValue, + Integer beforeOperateScale + ) { if (Objects.isNull(anotherValue)) { return this; } - if (anotherValue instanceof ChainedCalcUtil) { - this.value = operatorFunction.apply(((ChainedCalcUtil) anotherValue).getValue()); + if (anotherValue instanceof Calculator) { + this.value = operatorFunction.apply(((Calculator) anotherValue).getValue()); return this; } this.value = operatorFunction.apply(convertBigDecimal(anotherValue, beforeOperateScale)); @@ -366,8 +374,7 @@ public final class ChainedCalcUtil { } /** - * -- GETTER -- - * Returns the current value as a BigDecimal. + * Final result. */ private BigDecimal value; From 84b526a0d2f26d635e1c4ac5792fd226b6404a3c Mon Sep 17 00:00:00 2001 From: zihluwang Date: Fri, 12 Sep 2025 22:04:21 +0800 Subject: [PATCH 12/13] feat(util): add ObjectMapAdapter interface for object-map conversion Introduce new interface to facilitate conversion between objects and maps for serialization/deserialization purposes --- .../com/onixbyte/common/{util => adapter}/ObjectMapAdapter.java | 2 +- .../src/main/java/com/onixbyte/common/util/MapUtil.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) rename common-toolbox/src/main/java/com/onixbyte/common/{util => adapter}/ObjectMapAdapter.java (98%) diff --git a/common-toolbox/src/main/java/com/onixbyte/common/util/ObjectMapAdapter.java b/common-toolbox/src/main/java/com/onixbyte/common/adapter/ObjectMapAdapter.java similarity index 98% rename from common-toolbox/src/main/java/com/onixbyte/common/util/ObjectMapAdapter.java rename to common-toolbox/src/main/java/com/onixbyte/common/adapter/ObjectMapAdapter.java index aa66469..4852fa2 100644 --- a/common-toolbox/src/main/java/com/onixbyte/common/util/ObjectMapAdapter.java +++ b/common-toolbox/src/main/java/com/onixbyte/common/adapter/ObjectMapAdapter.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.onixbyte.common.util; +package com.onixbyte.common.adapter; import java.util.Map; diff --git a/common-toolbox/src/main/java/com/onixbyte/common/util/MapUtil.java b/common-toolbox/src/main/java/com/onixbyte/common/util/MapUtil.java index a558cb7..050a003 100644 --- a/common-toolbox/src/main/java/com/onixbyte/common/util/MapUtil.java +++ b/common-toolbox/src/main/java/com/onixbyte/common/util/MapUtil.java @@ -22,6 +22,8 @@ package com.onixbyte.common.util; +import com.onixbyte.common.adapter.ObjectMapAdapter; + import java.util.Map; /** From 5b7fbfee066682a6a7908e881df6f864c9b10603 Mon Sep 17 00:00:00 2001 From: siujamo Date: Wed, 28 Jan 2026 14:07:32 +0800 Subject: [PATCH 13/13] chore: optimise dependencies --- crypto-toolbox/build.gradle.kts | 1 - gradle/libs.versions.toml | 14 +------------- version-catalogue/build.gradle.kts | 1 + 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/crypto-toolbox/build.gradle.kts b/crypto-toolbox/build.gradle.kts index 72c9242..c0692c4 100644 --- a/crypto-toolbox/build.gradle.kts +++ b/crypto-toolbox/build.gradle.kts @@ -57,7 +57,6 @@ tasks.withType { dependencies { compileOnly(libs.slf4j) implementation(libs.logback) - testImplementation(libs.jwt.core) testImplementation(platform(libs.junit.bom)) testImplementation(libs.junit.jupiter) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 64b7a22..44bd9ab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,23 +15,11 @@ [versions] slf4j = "2.0.17" -logback = "1.5.18" -jackson = "2.18.4" -jwt = "4.5.0" -spring = "6.2.6" -springBoot = "3.4.5" +logback = "1.5.26" junit = "5.11.4" [libraries] slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } logback = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" } -jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core", version.ref = "jackson" } -jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" } -jwt-core = { group = "com.auth0", name = "java-jwt", version.ref = "jwt" } -springBoot-autoconfigure = { group = "org.springframework.boot", name = "spring-boot-autoconfigure", version.ref = "springBoot" } -springBoot-starter-logging = { group = "org.springframework.boot", name = "spring-boot-starter-logging", version.ref = "springBoot" } -springBoot-configurationProcessor = { group = "org.springframework.boot", name = "spring-boot-configuration-processor", version.ref = "springBoot" } -springBoot-starter-redis = { group = "org.springframework.boot", name = "spring-boot-starter-data-redis", version.ref = "springBoot" } -springBoot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test", version.ref = "springBoot" } junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit" } junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" } diff --git a/version-catalogue/build.gradle.kts b/version-catalogue/build.gradle.kts index ea4c522..ad0c74b 100644 --- a/version-catalogue/build.gradle.kts +++ b/version-catalogue/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { api("com.onixbyte:identity-generator:$artefactVersion") api("com.onixbyte:crypto-toolbox:$artefactVersion") api("com.onixbyte:math-toolbox:$artefactVersion") + api("com.onixbyte:tuple:$artefactVersion") } }