diff --git a/gradle.properties b/gradle.properties index 5c49f54..3a9da81 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,10 +16,10 @@ # ProjectName mingli-utils # ModuleName mingli-utils # CurrentFile gradle.properties -# LastUpdate 2026-10-12 13:57:03 +# LastUpdate 2026-10-22 20:26:20 # UpdateUser MingLiPro # JDKVERSIONS=17 GROUPSID=com.mingliqiye.utils ARTIFACTID=mingli-utils -VERSIONS=5.3.2 +VERSIONS=5.3.4 diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/BadGatewayException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/BadGatewayException.kt index 12383fb..d255b4d 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/BadGatewayException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/BadGatewayException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile BadGatewayException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:07:34 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Bad Gateway" * @param cause 异常原因,默认为 null */ -class BadGatewayException( +class BadGatewayException @JvmOverloads constructor( override val message: String? = "Bad Gateway", override val cause: Throwable? = null, ) : HttpStatusException(502, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/BadRequestException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/BadRequestException.kt index 6740250..f8eced9 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/BadRequestException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/BadRequestException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile BadRequestException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Bad Request" * @param cause 异常原因,默认为 null */ -class BadRequestException( +class BadRequestException @JvmOverloads constructor( override val message: String? = "Bad Request", override val cause: Throwable? = null, ) : HttpStatusException(400, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/ConflictException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/ConflictException.kt index 8027621..60e12f5 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/ConflictException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/ConflictException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile ConflictException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Conflict" * @param cause 异常原因,默认为 null */ -class ConflictException( +class ConflictException @JvmOverloads constructor( override val message: String? = "Conflict", override val cause: Throwable? = null, ) : HttpStatusException(409, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/ForbiddenException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/ForbiddenException.kt index e0700c8..41cb9f0 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/ForbiddenException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/ForbiddenException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile ForbiddenException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Forbidden" * @param cause 异常原因,默认为 null */ -class ForbiddenException( +class ForbiddenException @JvmOverloads constructor( override val message: String? = "Forbidden", override val cause: Throwable? = null, ) : HttpStatusException(403, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/FoundException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/FoundException.kt index 5474ffc..6275dab 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/FoundException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/FoundException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile FoundException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Found" * @param cause 异常原因,默认为 null */ -class FoundException( +class FoundException @JvmOverloads constructor( override val message: String? = "Found", override val cause: Throwable? = null, ) : HttpStatusException(302, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/GatewayTimeoutException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/GatewayTimeoutException.kt index 301411d..4714944 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/GatewayTimeoutException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/GatewayTimeoutException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile GatewayTimeoutException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Gateway Timeout" * @param cause 异常原因,默认为 null */ -class GatewayTimeoutException( +class GatewayTimeoutException @JvmOverloads constructor( override val message: String? = "Gateway Timeout", override val cause: Throwable? = null, ) : HttpStatusException(504, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/GoneException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/GoneException.kt index bf40e6b..262dddf 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/GoneException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/GoneException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile GoneException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Gone" * @param cause 异常原因,默认为 null */ -class GoneException( +class GoneException @JvmOverloads constructor( override val message: String? = "Gone", override val cause: Throwable? = null, ) : HttpStatusException(410, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/HttpVersionNotSupportedException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/HttpVersionNotSupportedException.kt index 3657716..26240a8 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/HttpVersionNotSupportedException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/HttpVersionNotSupportedException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile HttpVersionNotSupportedException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "HTTP Version Not Supported" * @param cause 异常原因,默认为 null */ -class HttpVersionNotSupportedException( +class HttpVersionNotSupportedException @JvmOverloads constructor( override val message: String? = "HTTP Version Not Supported", override val cause: Throwable? = null, ) : HttpStatusException(505, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/InternalServerErrorException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/InternalServerErrorException.kt index 6b3e014..0107830 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/InternalServerErrorException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/InternalServerErrorException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile InternalServerErrorException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Internal Server Error" * @param cause 异常原因,默认为 null */ -class InternalServerErrorException( +class InternalServerErrorException @JvmOverloads constructor( override val message: String? = "Internal Server Error", override val cause: Throwable? = null, ) : HttpStatusException(500, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/LengthRequiredException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/LengthRequiredException.kt index 7b00c53..4250b3a 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/LengthRequiredException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/LengthRequiredException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile LengthRequiredException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Length Required" * @param cause 异常原因,默认为 null */ -class LengthRequiredException( +class LengthRequiredException @JvmOverloads constructor( override val message: String? = "Length Required", override val cause: Throwable? = null, ) : HttpStatusException(411, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/MethodNotAllowedException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/MethodNotAllowedException.kt index 9e49a0e..d2055e7 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/MethodNotAllowedException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/MethodNotAllowedException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile MethodNotAllowedException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Method Not Allowed" * @param cause 异常原因,默认为 null */ -class MethodNotAllowedException( +class MethodNotAllowedException @JvmOverloads constructor( override val message: String? = "Method Not Allowed", override val cause: Throwable? = null, ) : HttpStatusException(405, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/MovedPermanentlyException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/MovedPermanentlyException.kt index 9e99733..29ea0f2 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/MovedPermanentlyException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/MovedPermanentlyException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile MovedPermanentlyException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Moved Permanently" * @param cause 异常原因,默认为 null */ -class MovedPermanentlyException( +class MovedPermanentlyException @JvmOverloads constructor( override val message: String? = "Moved Permanently", override val cause: Throwable? = null, ) : HttpStatusException(301, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/MultipleChoicesException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/MultipleChoicesException.kt index 03417eb..66013a6 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/MultipleChoicesException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/MultipleChoicesException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile MultipleChoicesException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Multiple Choices" * @param cause 异常原因,默认为 null */ -class MultipleChoicesException( +class MultipleChoicesException @JvmOverloads constructor( override val message: String? = "Multiple Choices", override val cause: Throwable? = null, ) : HttpStatusException(300, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/NotAcceptableException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/NotAcceptableException.kt index 0eab586..4c5c933 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/NotAcceptableException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/NotAcceptableException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile NotAcceptableException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Not Acceptable" * @param cause 异常原因,默认为 null */ -class NotAcceptableException( +class NotAcceptableException @JvmOverloads constructor( override val message: String? = "Not Acceptable", override val cause: Throwable? = null, ) : HttpStatusException(406, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/NotFoundException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/NotFoundException.kt index 9918860..94cb70b 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/NotFoundException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/NotFoundException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile NotFoundException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Not Found" * @param cause 异常原因,默认为 null */ -class NotFoundException( +class NotFoundException @JvmOverloads constructor( override val message: String? = "Not Found", override val cause: Throwable? = null, ) : HttpStatusException(404, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/NotImplementedException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/NotImplementedException.kt index 7cbed2d..87140d0 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/NotImplementedException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/NotImplementedException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile NotImplementedException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Not Implemented" * @param cause 异常原因,默认为 null */ -class NotImplementedException( +class NotImplementedException @JvmOverloads constructor( override val message: String? = "Not Implemented", override val cause: Throwable? = null, ) : HttpStatusException(501, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/NotModifiedException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/NotModifiedException.kt index 6ab4f46..5ade708 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/NotModifiedException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/NotModifiedException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile NotModifiedException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Not Modified" * @param cause 异常原因,默认为 null */ -class NotModifiedException( +class NotModifiedException @JvmOverloads constructor( override val message: String? = "Not Modified", override val cause: Throwable? = null, ) : HttpStatusException(304, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/PaymentRequiredException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/PaymentRequiredException.kt index 3c69664..4be7f46 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/PaymentRequiredException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/PaymentRequiredException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile PaymentRequiredException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Payment Required" * @param cause 异常原因,默认为 null */ -class PaymentRequiredException( +class PaymentRequiredException @JvmOverloads constructor( override val message: String? = "Payment Required", override val cause: Throwable? = null, ) : HttpStatusException(402, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/PreconditionFailedException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/PreconditionFailedException.kt index ce05382..08d5afa 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/PreconditionFailedException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/PreconditionFailedException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile PreconditionFailedException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Precondition Failed" * @param cause 异常原因,默认为 null */ -class PreconditionFailedException( +class PreconditionFailedException @JvmOverloads constructor( override val message: String? = "Precondition Failed", override val cause: Throwable? = null, ) : HttpStatusException(412, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/ProxyAuthenticationRequiredException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/ProxyAuthenticationRequiredException.kt index 2c784f1..9ad0b25 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/ProxyAuthenticationRequiredException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/ProxyAuthenticationRequiredException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile ProxyAuthenticationRequiredException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Proxy Authentication Required" * @param cause 异常原因,默认为 null */ -class ProxyAuthenticationRequiredException( +class ProxyAuthenticationRequiredException @JvmOverloads constructor( override val message: String? = "Proxy Authentication Required", override val cause: Throwable? = null, ) : HttpStatusException(407, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/RequestEntityTooLargeException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/RequestEntityTooLargeException.kt index 0ef8bc7..eb296ec 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/RequestEntityTooLargeException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/RequestEntityTooLargeException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile RequestEntityTooLargeException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Request Entity Too Large" * @param cause 异常原因,默认为 null */ -class RequestEntityTooLargeException( +class RequestEntityTooLargeException @JvmOverloads constructor( override val message: String? = "Request Entity Too Large", override val cause: Throwable? = null, ) : HttpStatusException(413, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/RequestTimeoutException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/RequestTimeoutException.kt index 8c29bf1..1829ffe 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/RequestTimeoutException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/RequestTimeoutException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile RequestTimeoutException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Request Timeout" * @param cause 异常原因,默认为 null */ -class RequestTimeoutException( +class RequestTimeoutException @JvmOverloads constructor( override val message: String? = "Request Timeout", override val cause: Throwable? = null, ) : HttpStatusException(408, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/RequestUriTooLargeException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/RequestUriTooLargeException.kt index d7c8bc6..86e90bc 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/RequestUriTooLargeException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/RequestUriTooLargeException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile RequestUriTooLargeException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Request URI Too Large" * @param cause 异常原因,默认为 null */ -class RequestUriTooLargeException( +class RequestUriTooLargeException @JvmOverloads constructor( override val message: String? = "Request URI Too Large", override val cause: Throwable? = null, ) : HttpStatusException(414, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/RequestedRangeNotSatisfiableException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/RequestedRangeNotSatisfiableException.kt index 64773a6..ba285db 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/RequestedRangeNotSatisfiableException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/RequestedRangeNotSatisfiableException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile RequestedRangeNotSatisfiableException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Requested Range Not Satisfiable" * @param cause 异常原因,默认为 null */ -class RequestedRangeNotSatisfiableException( +class RequestedRangeNotSatisfiableException @JvmOverloads constructor( override val message: String? = "Requested Range Not Satisfiable", override val cause: Throwable? = null, ) : HttpStatusException(416, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/SeeOtherException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/SeeOtherException.kt index bcbe25e..76f1d5a 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/SeeOtherException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/SeeOtherException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile SeeOtherException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "See Other" * @param cause 异常原因,默认为 null */ -class SeeOtherException( +class SeeOtherException @JvmOverloads constructor( override val message: String? = "See Other", override val cause: Throwable? = null, ) : HttpStatusException(303, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/ServiceUnavailableException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/ServiceUnavailableException.kt index d231881..963117c 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/ServiceUnavailableException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/ServiceUnavailableException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile ServiceUnavailableException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Service Unavailable" * @param cause 异常原因,默认为 null */ -class ServiceUnavailableException( +class ServiceUnavailableException @JvmOverloads constructor( override val message: String? = "Service Unavailable", override val cause: Throwable? = null, ) : HttpStatusException(503, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/TemporaryRedirectException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/TemporaryRedirectException.kt index eaccf2f..552b5b0 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/TemporaryRedirectException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/TemporaryRedirectException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile TemporaryRedirectException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Temporary Redirect" * @param cause 异常原因,默认为 null */ -class TemporaryRedirectException( +class TemporaryRedirectException @JvmOverloads constructor( override val message: String? = "Temporary Redirect", override val cause: Throwable? = null, ) : HttpStatusException(307, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/UnauthorizedException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/UnauthorizedException.kt index c1d936e..4fa8d6a 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/UnauthorizedException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/UnauthorizedException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile UnauthorizedException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Unauthorized" * @param cause 异常原因,默认为 null */ -class UnauthorizedException( +class UnauthorizedException @JvmOverloads constructor( override val message: String? = "Unauthorized", override val cause: Throwable? = null, ) : HttpStatusException(401, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/UnsupportedMediaTypeException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/UnsupportedMediaTypeException.kt index c21f046..d528f91 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/UnsupportedMediaTypeException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/UnsupportedMediaTypeException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile UnsupportedMediaTypeException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:19 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Unsupported Media Type" * @param cause 异常原因,默认为 null */ -class UnsupportedMediaTypeException( +class UnsupportedMediaTypeException @JvmOverloads constructor( override val message: String? = "Unsupported Media Type", override val cause: Throwable? = null, ) : HttpStatusException(415, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/exception/UseProxyException.kt b/src/main/kotlin/com/mingliqiye/utils/exception/UseProxyException.kt index 870a815..ed770bf 100644 --- a/src/main/kotlin/com/mingliqiye/utils/exception/UseProxyException.kt +++ b/src/main/kotlin/com/mingliqiye/utils/exception/UseProxyException.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile UseProxyException.kt - * LastUpdate 2026-02-05 14:55:04 + * LastUpdate 2026-10-22 22:09:48 * UpdateUser MingLiPro */ @@ -28,7 +28,7 @@ package com.mingliqiye.utils.exception * @param message 异常信息,默认为 "Use Proxy" * @param cause 异常原因,默认为 null */ -class UseProxyException( +class UseProxyException @JvmOverloads constructor( override val message: String? = "Use Proxy", override val cause: Throwable? = null, ) : HttpStatusException(305, message, cause) diff --git a/src/main/kotlin/com/mingliqiye/utils/functions/Pipeline.kt b/src/main/kotlin/com/mingliqiye/utils/functions/Pipeline.kt index ab9e47e..9277d41 100644 --- a/src/main/kotlin/com/mingliqiye/utils/functions/Pipeline.kt +++ b/src/main/kotlin/com/mingliqiye/utils/functions/Pipeline.kt @@ -16,13 +16,13 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile Pipeline.kt - * LastUpdate 2026-02-24 09:10:26 + * LastUpdate 2026-10-20 20:59:13 * UpdateUser MingLiPro */ package com.mingliqiye.utils.functions -import com.mingliqiye.utils.require.Require +import com.mingliqiye.utils.require.requireTrue import kotlin.reflect.KClass /** @@ -159,9 +159,9 @@ class Pipeline(private val value: T) { * @return 当前Pipeline实例 */ fun require( - any: Any, message: String, exception: Class = IllegalArgumentException::class.java + any: Any, message: String, exception: Class = IllegalArgumentException::class.java, ): Pipeline { - Require.require(any == value, message, exception) + requireTrue(any == value, exception, message) return this } @@ -173,9 +173,9 @@ class Pipeline(private val value: T) { * @return 当前Pipeline实例 */ fun require( - any: Any, message: String + any: Any, message: String, ): Pipeline { - Require.require(any == value, message) + requireTrue(any == value, message) return this } @@ -189,9 +189,9 @@ class Pipeline(private val value: T) { fun require( must: P1RFunction, message: String, - exception: Class = IllegalArgumentException::class.java + exception: Class = IllegalArgumentException::class.java, ): Pipeline { - Require.require(must.call(value), message, exception) + requireTrue(must.call(value), exception, message) return this } @@ -205,9 +205,9 @@ class Pipeline(private val value: T) { fun require( any: Any, message: String, - exception: KClass = IllegalArgumentException::class + exception: KClass = IllegalArgumentException::class, ): Pipeline { - Require.require(any == value, message, exception) + requireTrue(any == value, exception.java, message) return this } @@ -219,11 +219,11 @@ class Pipeline(private val value: T) { * @return 当前Pipeline实例 */ fun require( - must: P1RFunction, + must: (T) -> Boolean, message: String, - exception: KClass = IllegalArgumentException::class + exception: KClass = IllegalArgumentException::class, ): Pipeline { - Require.require(must.call(value), message, exception) + requireTrue(must(value), exception.java, message) return this } @@ -234,9 +234,9 @@ class Pipeline(private val value: T) { * @return 当前Pipeline实例 */ fun require( - must: P1RFunction, message: String + must: P1RFunction, message: String, ): Pipeline { - Require.require(must.call(value), message, IllegalArgumentException::class.java) + requireTrue(must.call(value), message) return this } @@ -259,7 +259,7 @@ class Pipeline(private val value: T) { */ fun require( predicate: P1RFunction, - lazyMessage: P1RFunction = P1RFunction { "Requirement failed" } + lazyMessage: P1RFunction = P1RFunction { "Requirement failed" }, ): Pipeline { if (!predicate.call(value)) { throw IllegalArgumentException(lazyMessage.call(value).toString()) diff --git a/src/main/kotlin/com/mingliqiye/utils/http/okhttp/OkHttpUtils.kt b/src/main/kotlin/com/mingliqiye/utils/http/okhttp/OkHttpUtils.kt index 172d38c..c7a41d5 100644 --- a/src/main/kotlin/com/mingliqiye/utils/http/okhttp/OkHttpUtils.kt +++ b/src/main/kotlin/com/mingliqiye/utils/http/okhttp/OkHttpUtils.kt @@ -16,35 +16,45 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile OkHttpUtils.kt - * LastUpdate 2026-02-27 22:16:15 + * LastUpdate 2026-10-22 20:20:42 * UpdateUser MingLiPro */ @file:JvmName("OkHttpUtils") package com.mingliqiye.utils.http.okhttp -import com.mingliqiye.utils.http.MediaType -import com.mingliqiye.utils.http.okhttp import com.mingliqiye.utils.json.api.JSONA -import com.mingliqiye.utils.json.api.JSONA.toJson +import com.mingliqiye.utils.json.api.base.JsonApi +import com.mingliqiye.utils.json.api.base.JsonApi.Companion.parse +import okhttp3.Call import okhttp3.OkHttpClient import okhttp3.Request -import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.Response -inline fun Response.json() = body.use { - JSONA.parse(it.bytes()) +inline fun Response.json(jsonApi: JsonApi? = null): T = body.use { + if (jsonApi != null) { + return jsonApi.parse(it.bytes()) + } else { + JSONA.parse(it.bytes()) + } } fun Response.text() = body.use { String(it.bytes()) } -fun OkHttpClient.request() = Request.Builder() -fun Request.Builder.call(okHttpClient: OkHttpClient) = okHttpClient.newCall(this.build()) -fun Request.Builder.postWithJson(data: Any): Request.Builder { - data.toJson().toRequestBody(MediaType.APPLICATION_JSON.okhttp()) - return this +fun newRequest(calld: Request.Builder.() -> Unit): Request { + val request = Request.Builder() + calld(request) + return request.build() +} + +fun OkHttpClient.newCall(calld: Request.Builder.() -> Unit): Call { + return this.newCall(newRequest(calld)) +} + +fun OkHttpClient.newExecute(calld: Request.Builder.() -> Unit): Response { + return this.newCall(newRequest(calld)).execute() } diff --git a/src/main/kotlin/com/mingliqiye/utils/io/SIO.kt b/src/main/kotlin/com/mingliqiye/utils/io/SIO.kt index bf6b4e8..864b154 100644 --- a/src/main/kotlin/com/mingliqiye/utils/io/SIO.kt +++ b/src/main/kotlin/com/mingliqiye/utils/io/SIO.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile SIO.kt - * LastUpdate 2026-06-21 10:40:58 + * LastUpdate 2026-10-22 20:21:49 * UpdateUser MingLiPro */ @@ -29,68 +29,6 @@ import org.slf4j.Logger import java.io.OutputStream import java.io.PrintStream -/** - * 已弃用的IO对象,所有方法都委托给SIO对象 - * @deprecated 请使用SIO对象替代 - */ -@Deprecated("This IO is deprecated. reName SIO", replaceWith = ReplaceWith("SIO"), level = DeprecationLevel.WARNING) -object IO { - /** - * 打印多个参数,使用空格分隔 - * @param args 要打印的参数数组 - */ - @JvmStatic - fun print(vararg args: Any?) = SIO.print(*args) - - /** - * 打印多个参数并换行,使用空格分隔 - * @param args 要打印的参数数组 - */ - @JvmStatic - fun println(vararg args: Any?) = SIO.println(*args) - - /** - * 打印多个参数并换行,指定分隔符 - * @param sp 分隔符 - * @param args 要打印的参数数组 - */ - @JvmStatic - fun printlnA(sp: String, vararg args: Any?) = SIO.printlnA(sp, *args) - - /** - * 打印多个参数,指定分隔符 - * @param sp 分隔符,默认为空字符串 - * @param args 要打印的参数数组 - */ - @JvmStatic - fun printA(sp: String = "", vararg args: Any?) = SIO.printA(sp, *args) - - /** - * 重定向 System.out 到 INFO 级别日志 - */ - @JvmStatic - fun redirectOutToInfo() = SIO.redirectOutToInfo() - - /** - * 重定向 System.err 到 ERROR 级别 - */ - @JvmStatic - fun redirectErrToError() = SIO.redirectErrToError() - - /** - * 完全重定向(包括第三方库的输出) - */ - @JvmStatic - fun redirectAll() = SIO.redirectAll() - - /** - * 恢复原始输出流 - */ - @JvmStatic - fun restore() = SIO.restore() -} - - /** * IO工具类,提供打印功能和系统输出流重定向到日志的功能 */ diff --git a/src/main/kotlin/com/mingliqiye/utils/objects/BooleanUtils.kt b/src/main/kotlin/com/mingliqiye/utils/objects/BooleanUtils.kt new file mode 100644 index 0000000..fa223fd --- /dev/null +++ b/src/main/kotlin/com/mingliqiye/utils/objects/BooleanUtils.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2026 mingliqiye + * + * 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. + * + * ProjectName mingli-utils + * ModuleName mingli-utils.main + * CurrentFile BooleanUtils.kt + * LastUpdate 2026-10-22 19:57:04 + * UpdateUser MingLiPro + */ + +package com.mingliqiye.utils.objects + +class BooleanIfFunction(private val boolean: Boolean) { + + fun elses(function: () -> Unit): Boolean { + if (boolean) { + function() + } + return !boolean + } +} + +inline fun Boolean.ifs(function: () -> Unit): BooleanIfFunction { + return if (this) { + function() + BooleanIfFunction(false) + } else BooleanIfFunction(true) +} diff --git a/src/main/kotlin/com/mingliqiye/utils/require/RequireTrue.kt b/src/main/kotlin/com/mingliqiye/utils/require/RequireTrue.kt index 93d2075..11cb623 100644 --- a/src/main/kotlin/com/mingliqiye/utils/require/RequireTrue.kt +++ b/src/main/kotlin/com/mingliqiye/utils/require/RequireTrue.kt @@ -16,7 +16,7 @@ * ProjectName mingli-utils * ModuleName mingli-utils.main * CurrentFile RequireTrue.kt - * LastUpdate 2026-10-20 20:05:24 + * LastUpdate 2026-10-20 21:07:55 * UpdateUser MingLiPro */ @@ -58,16 +58,17 @@ class Required(private val newException: (message: String) -> T) } -fun newRequired(): Required { - return newRequired() -} - fun newRequired(clazz: Class): Required { return Required { newException(clazz, it) } } +fun newRequired(): Required { + return newRequired() +} + +@JvmName("newRequiredInline") inline fun newRequired(): Required { return newRequired(T::class.java) } @@ -84,6 +85,7 @@ fun newException(clazz: Class, msg: String): T = try { } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueDef") fun requireTrue(value: Boolean, clazz: Class, lazyMessage: () -> String) { contract { returns() implies value @@ -94,6 +96,7 @@ fun requireTrue(value: Boolean, clazz: Class, lazyMessage: () } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueInline") inline fun requireTrue(value: Boolean, noinline lazyMessage: () -> String) { contract { returns() implies value @@ -102,6 +105,7 @@ inline fun requireTrue(value: Boolean, noinline lazyMess } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueOnBoolean") fun Boolean.requireTrue(clazz: Class, lazyMessage: () -> String) { contract { returns() implies this@requireTrue @@ -110,6 +114,7 @@ fun Boolean.requireTrue(clazz: Class, lazyMessage: () -> Stri } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueOnBoolean") fun Boolean.requireTrue(clazz: Class, message: String) { contract { returns() implies this@requireTrue @@ -128,6 +133,7 @@ fun requireTrue(value: Boolean, clazz: Class, message: String } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueInline") inline fun requireTrue(value: Boolean, message: String) { contract { returns() implies value @@ -137,6 +143,7 @@ inline fun requireTrue(value: Boolean, message: String) @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueOnBoolean") inline fun Boolean.requireTrue(noinline lazyMessage: () -> String) { contract { returns() implies this@requireTrue @@ -146,6 +153,7 @@ inline fun Boolean.requireTrue(noinline lazyMessage: () } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueOnBoolean") inline fun Boolean.requireTrue(message: String) { contract { returns() implies this@requireTrue @@ -163,6 +171,7 @@ fun requireTrue(value: Boolean, clazz: Class) { } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueInline") inline fun requireTrue(value: Boolean) { contract { returns() implies value @@ -170,8 +179,33 @@ inline fun requireTrue(value: Boolean) { requireTrue(value, T::class.java) { DEFAULT_MESSAGE } } +@OptIn(ExperimentalContracts::class) +fun requireTrue(value: Boolean) { + contract { + returns() implies value + } + requireTrue(value, IllegalArgumentException::class.java) { DEFAULT_MESSAGE } +} @OptIn(ExperimentalContracts::class) +fun requireTrue(value: Boolean, message: String) { + contract { + returns() implies value + } + requireTrue(value, IllegalArgumentException::class.java) { message } +} + +@OptIn(ExperimentalContracts::class) +fun requireTrue(value: Boolean, lazyMessage: () -> String) { + contract { + returns() implies value + } + requireTrue(value, IllegalArgumentException::class.java, lazyMessage) +} + + +@OptIn(ExperimentalContracts::class) +@JvmName("requireTrueOnBoolean") fun Boolean.requireTrue(clazz: Class) { contract { returns() implies this@requireTrue @@ -181,6 +215,7 @@ fun Boolean.requireTrue(clazz: Class) { } @OptIn(ExperimentalContracts::class) +@JvmName("requireTrueOnBoolean") inline fun Boolean.requireTrue() { contract { returns() implies this@requireTrue