refactor: 重构 BasePropertyValidator 中 equal 和 notEqual 方法的参数命名

This commit is contained in:
zhouxy108 2025-06-08 04:38:52 +08:00
parent 654ecd8c63
commit 12a5740dd6

View File

@ -258,50 +258,50 @@ public abstract class BasePropertyValidator<
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final TPropertyValidator equal(Object that) { public final TPropertyValidator equal(Object obj) {
return withRule(Conditions.equal(that), return withRule(Conditions.equal(obj),
"The input must be equal to '%s'.", that); "The input must be equal to '%s'.", obj);
} }
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @param errorMessage 异常信息 * @param errorMessage 异常信息
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final TPropertyValidator equal( public final TPropertyValidator equal(
final Object that, final String errorMessage) { final Object obj, final String errorMessage) {
return withRule(Conditions.equal(that), errorMessage); return withRule(Conditions.equal(obj), errorMessage);
} }
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param <X> 自定义异常类型 * @param <X> 自定义异常类型
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @param exceptionSupplier 自定义异常 * @param exceptionSupplier 自定义异常
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final <X extends RuntimeException> TPropertyValidator equal( public final <X extends RuntimeException> TPropertyValidator equal(
final Object that, final Supplier<X> exceptionSupplier) { final Object obj, final Supplier<X> exceptionSupplier) {
return withRule(Conditions.equal(that), exceptionSupplier); return withRule(Conditions.equal(obj), exceptionSupplier);
} }
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param <X> 自定义异常类型 * @param <X> 自定义异常类型
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @param exceptionFunction 自定义异常 * @param exceptionFunction 自定义异常
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final <X extends RuntimeException> TPropertyValidator equal( public final <X extends RuntimeException> TPropertyValidator equal(
final Object that, final Function<TProperty, X> exceptionFunction) { final Object obj, final Function<TProperty, X> exceptionFunction) {
return withRule(Conditions.equal(that), exceptionFunction); return withRule(Conditions.equal(obj), exceptionFunction);
} }
// ================================ // ================================
@ -315,49 +315,49 @@ public abstract class BasePropertyValidator<
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final TPropertyValidator notEqual(final Object that) { public final TPropertyValidator notEqual(final Object obj) {
return withRule(Conditions.notEqual(that), return withRule(Conditions.notEqual(obj),
"The input must not equal '%s'.", that); "The input must not equal '%s'.", obj);
} }
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @param errorMessage 异常信息 * @param errorMessage 异常信息
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final TPropertyValidator notEqual(final Object that, final String errorMessage) { public final TPropertyValidator notEqual(final Object obj, final String errorMessage) {
return withRule(Conditions.notEqual(that), errorMessage); return withRule(Conditions.notEqual(obj), errorMessage);
} }
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param <X> 自定义异常类型 * @param <X> 自定义异常类型
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @param exceptionSupplier 自定义异常 * @param exceptionSupplier 自定义异常
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final <X extends RuntimeException> TPropertyValidator notEqual( public final <X extends RuntimeException> TPropertyValidator notEqual(
final Object that, final Supplier<X> exceptionSupplier) { final Object obj, final Supplier<X> exceptionSupplier) {
return withRule(Conditions.notEqual(that), exceptionSupplier); return withRule(Conditions.notEqual(obj), exceptionSupplier);
} }
/** /**
* 添加一条校验属性的规则校验属性是否等于给定值 * 添加一条校验属性的规则校验属性是否等于给定值
* *
* @param <X> 自定义异常类型 * @param <X> 自定义异常类型
* @param that 用于比较的对象 * @param obj 用于比较的对象
* @param exceptionFunction 自定义异常 * @param exceptionFunction 自定义异常
* @return 当前校验器实例用于链式调用 * @return 当前校验器实例用于链式调用
*/ */
public final <X extends RuntimeException> TPropertyValidator notEqual( public final <X extends RuntimeException> TPropertyValidator notEqual(
final Object that, final Function<TProperty, X> exceptionFunction) { final Object obj, final Function<TProperty, X> exceptionFunction) {
return withRule(Conditions.notEqual(that), exceptionFunction); return withRule(Conditions.notEqual(obj), exceptionFunction);
} }
// ================================ // ================================