refactor(i18n):Rename interfaces and classes to improve code clarity

- Rename the InternalInformation interface to I18nInternalInformation
- Rename the ResponseInformation interface to I18nResponseInformation
- Update the relevant references in the I18nBaseException class
This commit is contained in:
gewuyou 2025-05-30 14:04:17 +08:00
parent 3893d2ec38
commit fff96d18bb
3 changed files with 15 additions and 15 deletions

View File

@ -6,7 +6,7 @@ package com.gewuyou.forgeboot.i18n.api
* @author gewuyou * @author gewuyou
* @since 2024-11-26 17:14:15 * @since 2024-11-26 17:14:15
*/ */
interface InternalInformation { interface I18nInternalInformation {
/** /**
* 获取i18n响应信息code * 获取i18n响应信息code
* @return 响应信息 code * @return 响应信息 code

View File

@ -6,7 +6,7 @@ package com.gewuyou.forgeboot.i18n.api
* @author gewuyou * @author gewuyou
* @since 2025-05-03 16:31:59 * @since 2025-05-03 16:31:59
*/ */
interface ResponseInformation { interface I18nResponseInformation {
/** /**
* 获取响应码 * 获取响应码
* @return 响应码 * @return 响应码

View File

@ -1,6 +1,6 @@
package com.gewuyou.forgeboot.i18n.impl.exception package com.gewuyou.forgeboot.i18n.impl.exception
import com.gewuyou.forgeboot.i18n.api.ResponseInformation import com.gewuyou.forgeboot.i18n.api.I18nResponseInformation
/** /**
@ -17,18 +17,18 @@ open class I18nBaseException : RuntimeException {
* 响应信息对象用于存储错误代码和国际化消息代码 * 响应信息对象用于存储错误代码和国际化消息代码
*/ */
@Transient @Transient
private val responseInformation: ResponseInformation private val i18nResponseInformation: I18nResponseInformation
/** /**
* 构造函数 * 构造函数
* *
* 初始化异常对象用于当只有响应信息可用时 * 初始化异常对象用于当只有响应信息可用时
* *
* @param responseInformation 响应信息对象包含错误代码和国际化消息代码 * @param i18nResponseInformation 响应信息对象包含错误代码和国际化消息代码
*/ */
constructor(responseInformation: ResponseInformation) constructor(i18nResponseInformation: I18nResponseInformation)
: super(responseInformation.responseI8nMessageCode) { : super(i18nResponseInformation.responseI8nMessageCode) {
this.responseInformation = responseInformation this.i18nResponseInformation = i18nResponseInformation
} }
/** /**
@ -36,12 +36,12 @@ open class I18nBaseException : RuntimeException {
* *
* 初始化异常对象用于当有响应信息和异常原因时 * 初始化异常对象用于当有响应信息和异常原因时
* *
* @param responseInformation 响应信息对象包含错误代码和国际化消息代码 * @param i18nResponseInformation 响应信息对象包含错误代码和国际化消息代码
* @param cause 异常原因 * @param cause 异常原因
*/ */
constructor(responseInformation: ResponseInformation, cause: Throwable) constructor(i18nResponseInformation: I18nResponseInformation, cause: Throwable)
: super(responseInformation.responseI8nMessageCode, cause) { : super(i18nResponseInformation.responseI8nMessageCode, cause) {
this.responseInformation = responseInformation this.i18nResponseInformation = i18nResponseInformation
} }
/** /**
@ -50,7 +50,7 @@ open class I18nBaseException : RuntimeException {
* @return 错误代码 * @return 错误代码
*/ */
val errorCode: Int val errorCode: Int
get() = responseInformation.responseCode get() = i18nResponseInformation.responseCode
/** /**
* 获取国际化消息代码 * 获取国际化消息代码
@ -58,7 +58,7 @@ open class I18nBaseException : RuntimeException {
* @return 国际化消息代码 * @return 国际化消息代码
*/ */
val errorI18nMessageCode: String val errorI18nMessageCode: String
get() = responseInformation.responseI8nMessageCode get() = i18nResponseInformation.responseI8nMessageCode
/** /**
* 获取国际化消息参数 * 获取国际化消息参数
@ -66,5 +66,5 @@ open class I18nBaseException : RuntimeException {
* @return 国际化消息参数数组 * @return 国际化消息参数数组
*/ */
val errorI18nMessageArgs: Array<Any>? val errorI18nMessageArgs: Array<Any>?
get() = responseInformation.responseI8nMessageArgs get() = i18nResponseInformation.responseI8nMessageArgs
} }