Skip to content

Commit

Permalink
Make Arguments1ValidatorBuilder return Arguments1Validator instead …
Browse files Browse the repository at this point in the history
…of `ValueValidator` for the consistency (#397)
  • Loading branch information
making authored Jun 18, 2024
1 parent 5880d79 commit 9bfa18e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 8 additions & 4 deletions scripts/generate-args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,10 @@ import am.ik.yavi.arguments.Arguments1;
$(if [ "${i}" -gt 1 ];then
cat <<EOD
import am.ik.yavi.arguments.ArgumentsValidators;
EOD
fi)
$(if [ "${i}" -gt 0 ];then
cat <<EOD
import am.ik.yavi.arguments.Arguments${i}Validator;
EOD
fi)
Expand Down Expand Up @@ -1050,12 +1054,12 @@ EOD
fi)
$(if [ "${i}" == "1" ];then
cat <<EOD
public <X> ValueValidator<A1, X> apply(Function1<? super R1, ? extends X> f) {
return this.v1.andThen(f::apply);
public <X> Arguments1Validator<A1, X> apply(Function1<? super R1, ? extends X> f) {
return Arguments1Validator.from(this.v1.andThen(f::apply));
}
public ValueValidator<A1, R1> get() {
return this.v1;
public Arguments1Validator<A1, R1> get() {
return Arguments1Validator.from(this.v1);
}
EOD
fi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import am.ik.yavi.arguments.Arguments1;

import am.ik.yavi.arguments.Arguments1Validator;
import am.ik.yavi.constraint.BigDecimalConstraint;
import am.ik.yavi.constraint.BigIntegerConstraint;
import am.ik.yavi.constraint.BooleanConstraint;
Expand Down Expand Up @@ -332,11 +333,11 @@ public Arguments2ValidatorBuilder<A1, ZonedDateTime, R1, ZonedDateTime> _zonedDa
return this._zonedDateTime(name, Function.identity());
}

public <X> ValueValidator<A1, X> apply(Function1<? super R1, ? extends X> f) {
return this.v1.andThen(f::apply);
public <X> Arguments1Validator<A1, X> apply(Function1<? super R1, ? extends X> f) {
return Arguments1Validator.from(this.v1.andThen(f::apply));
}

public ValueValidator<A1, R1> get() {
return this.v1;
public Arguments1Validator<A1, R1> get() {
return Arguments1Validator.from(this.v1);
}
}

0 comments on commit 9bfa18e

Please sign in to comment.