docs(global): Optimised javadocs.
This commit is contained in:
@@ -39,6 +39,7 @@ import java.util.UUID;
|
||||
*
|
||||
* @author hubin@baomidou
|
||||
* @since 1.1.0
|
||||
* @version 1.1.0
|
||||
*/
|
||||
@Slf4j
|
||||
public final class AesUtil {
|
||||
|
||||
@@ -22,18 +22,15 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The {@code Base64Util} class provides static methods to encode and decode
|
||||
* strings using Base64 encoding. It utilizes the {@link Base64} class from the
|
||||
* Java standard library for performing the encoding and decoding operations.
|
||||
* This utility class offers convenient methods to encode and decode strings
|
||||
* with different character sets.
|
||||
*
|
||||
* <p>
|
||||
* This class is designed as a final class with a private constructor to
|
||||
* prevent instantiation. All methods in this class are static, allowing easy
|
||||
* access to the Base64 encoding and decoding functionality.
|
||||
*
|
||||
* <p>
|
||||
* Example usage:
|
||||
* <pre>
|
||||
@@ -47,15 +44,13 @@ import java.util.Base64;
|
||||
* String decoded = Base64Util.decode(encoded);
|
||||
* System.out.println("Decoded string: " + decoded);
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b> This utility class uses the default charset (UTF-8) if no
|
||||
* specific charset is provided. It is recommended to specify the charset
|
||||
* explicitly to ensure consistent encoding and decoding.
|
||||
*
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
* @version 1.0.0
|
||||
* @version 1.1.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public final class Base64Util {
|
||||
|
||||
@@ -23,19 +23,14 @@ import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The BranchUtil class provides static methods to simplify conditional logic
|
||||
* in Java development by leveraging lambda expressions. It offers convenient
|
||||
* methods to replace verbose if...else statements with more concise and
|
||||
* expressive functional constructs.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Developers can use the methods in this utility class to streamline their
|
||||
* code, enhance readability, and promote a more functional style of
|
||||
* programming when dealing with branching logic and conditional statements.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* <b>Example:</b>
|
||||
* <pre>
|
||||
@@ -67,7 +62,6 @@ import java.util.function.Supplier;
|
||||
* // do something
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b>
|
||||
* The {@link #and(Boolean...)} and {@link #or(Boolean...)} methods accept any
|
||||
@@ -75,7 +69,7 @@ import java.util.function.Supplier;
|
||||
*
|
||||
* @param <T> the type of the result to be handled by the methods
|
||||
* @author Zihlu Wang
|
||||
* @version 1.0.0
|
||||
* @version 1.1.0
|
||||
* @see java.util.function.Supplier
|
||||
* @see java.util.function.BooleanSupplier
|
||||
* @see java.lang.Runnable
|
||||
@@ -164,15 +158,12 @@ public final class BranchUtil<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Handles the result of the boolean expressions by executing the
|
||||
* appropriate handler based on the result.
|
||||
*
|
||||
* <p>
|
||||
* If the result is {@code true}, the {@code ifHandler} is executed. If the
|
||||
* result is {@code false} and an {@code elseHandler} is provided, it is
|
||||
* executed.
|
||||
*
|
||||
* <p>
|
||||
* Returns the result of the executed handler.
|
||||
*
|
||||
@@ -181,7 +172,8 @@ public final class BranchUtil<T> {
|
||||
* @param elseHandler the handler to be executed if the result is
|
||||
* {@code false} (optional)
|
||||
* @return the result of the executed handler, or {@code null} if no
|
||||
* {@code elseHandler} is provided
|
||||
* {@code elseHandler} is provided and the result of the evaluation is
|
||||
* {@code false}
|
||||
*/
|
||||
public T handle(Supplier<T> ifHandler, Supplier<T> elseHandler) {
|
||||
if (this.result && Objects.nonNull(ifHandler)) {
|
||||
@@ -196,26 +188,23 @@ public final class BranchUtil<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Handles the result of the boolean expressions by executing the provided
|
||||
* handler if the result is {@code true}.
|
||||
*
|
||||
* <p>
|
||||
* Returns the result of the executed handler.
|
||||
*
|
||||
* @param ifHandler the handler to be executed if the result is
|
||||
* {@code true}
|
||||
* @return the result of the executed handler
|
||||
* @return the result of the executed handler, or {@code null} if result of
|
||||
* evaluation is {@code false}
|
||||
*/
|
||||
public T handle(Supplier<T> ifHandler) {
|
||||
return handle(ifHandler, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Handles the result of the boolean expressions by executing the
|
||||
* appropriate handler based on the result.
|
||||
*
|
||||
* <p>
|
||||
* If the result is {@code true}, the {@code ifHandler} is executed. If the
|
||||
* result is {@code false} and an {@code elseHandler} is provided, it is
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
package cn.org.codecrafters.devkit.utils;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Objects;
|
||||
@@ -24,10 +26,7 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Utility class for chained high-precision calculations using BigDecimal.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* The ChainedCalcUtil class provides a convenient way to perform chained
|
||||
* high-precision calculations using BigDecimal. It allows users to perform
|
||||
@@ -35,8 +34,6 @@ import java.util.function.Function;
|
||||
* and division with customizable precision and scale. By using this utility
|
||||
* class, developers can achieve accurate results and avoid precision loss
|
||||
* in their calculations.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* <b>Usage:</b>
|
||||
* <pre>
|
||||
@@ -85,7 +82,6 @@ import java.util.function.Function;
|
||||
* </pre>
|
||||
* The above expressions perform various mathematical calculations using the
|
||||
* ChainedCalcUtil class.
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b>
|
||||
* The ChainedCalcUtil class internally uses BigDecimal to handle
|
||||
@@ -94,12 +90,17 @@ import java.util.function.Function;
|
||||
* for extremely large numbers or complex calculations.
|
||||
*
|
||||
* @author sunzsh
|
||||
* @version 1.0.0
|
||||
* @version 1.1.0
|
||||
* @see java.math.BigDecimal
|
||||
* @since 9 Jul 2023
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Getter
|
||||
public final class ChainedCalcUtil {
|
||||
|
||||
/**
|
||||
* -- GETTER --
|
||||
* Returns the current value as a BigDecimal.
|
||||
*/
|
||||
private BigDecimal value;
|
||||
|
||||
/**
|
||||
@@ -234,15 +235,6 @@ public final class ChainedCalcUtil {
|
||||
return baseOperator(otherValue -> this.value.divide(otherValue, scale, RoundingMode.HALF_UP), other, beforeOperateScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current value as a BigDecimal.
|
||||
*
|
||||
* @return the current value as a BigDecimal
|
||||
*/
|
||||
public BigDecimal getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current value as a BigDecimal with the specified scale.
|
||||
*
|
||||
|
||||
@@ -25,15 +25,12 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Utility class for performing hash operations on strings.
|
||||
*
|
||||
* <p>
|
||||
* The HashUtil class provides convenient methods for calculating various hash
|
||||
* functions on strings, including MD2, MD5, SHA-1, SHA-224, SHA-256, SHA-384,
|
||||
* and SHA-512. It allows developers to easily obtain the hash value of a given
|
||||
* string using different algorithms.
|
||||
*
|
||||
* <p>
|
||||
* Example usage:
|
||||
* <pre>
|
||||
@@ -60,7 +57,6 @@ import java.util.Optional;
|
||||
* </pre>
|
||||
* The above examples demonstrate how to use the HashUtil class to calculate
|
||||
* hash values for a given string using different algorithms.
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b>
|
||||
* The hash functions provided by the HashUtil class are one-way hash
|
||||
@@ -69,7 +65,7 @@ import java.util.Optional;
|
||||
* password storage, but they should not be used for encryption purposes.
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
* @version 1.0.0
|
||||
* @version 1.1.0
|
||||
* @see java.security.MessageDigest
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
@@ -24,17 +24,15 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* MapUtil is a utility class that provides methods for converting objects to
|
||||
* maps and maps to objects.
|
||||
*
|
||||
* <p>
|
||||
* It also provides methods for getting and setting field values using
|
||||
* reflection.
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
* @version 1.0.0
|
||||
* @since 16 Jul 2023
|
||||
* @version 1.1.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
public final class MapUtil {
|
||||
|
||||
Reference in New Issue
Block a user