├── .github ├── dependabot.yml └── workflows │ └── ci.yaml ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .springjavaformatconfig ├── CONTRIBUTING.md ├── How-To-Release.md ├── LICENSE ├── README.md ├── docs ├── AnnotationProcessor.md ├── FromBeanValidationToYAVI.md └── GettingStarted.md ├── get-release-version.sh ├── merge-main-to-develop.sh ├── mvnw ├── mvnw.cmd ├── pom.xml ├── scripts ├── generate-applicative.sh ├── generate-args.sh └── generate-function.sh ├── set-next-minor-version.sh ├── set-next-patch-version.sh ├── set-release-version.sh └── src ├── etc ├── header-definition.xml └── header.txt ├── main ├── java │ └── am │ │ └── ik │ │ └── yavi │ │ ├── arguments │ │ ├── Arguments.java │ │ ├── Arguments1.java │ │ ├── Arguments10.java │ │ ├── Arguments10Combining.java │ │ ├── Arguments10Splitting.java │ │ ├── Arguments10Validator.java │ │ ├── Arguments11.java │ │ ├── Arguments11Combining.java │ │ ├── Arguments11Splitting.java │ │ ├── Arguments11Validator.java │ │ ├── Arguments12.java │ │ ├── Arguments12Combining.java │ │ ├── Arguments12Splitting.java │ │ ├── Arguments12Validator.java │ │ ├── Arguments13.java │ │ ├── Arguments13Combining.java │ │ ├── Arguments13Splitting.java │ │ ├── Arguments13Validator.java │ │ ├── Arguments14.java │ │ ├── Arguments14Combining.java │ │ ├── Arguments14Splitting.java │ │ ├── Arguments14Validator.java │ │ ├── Arguments15.java │ │ ├── Arguments15Combining.java │ │ ├── Arguments15Splitting.java │ │ ├── Arguments15Validator.java │ │ ├── Arguments16.java │ │ ├── Arguments16Combining.java │ │ ├── Arguments16Splitting.java │ │ ├── Arguments16Validator.java │ │ ├── Arguments1Validator.java │ │ ├── Arguments2.java │ │ ├── Arguments2Combining.java │ │ ├── Arguments2Splitting.java │ │ ├── Arguments2Validator.java │ │ ├── Arguments3.java │ │ ├── Arguments3Combining.java │ │ ├── Arguments3Splitting.java │ │ ├── Arguments3Validator.java │ │ ├── Arguments4.java │ │ ├── Arguments4Combining.java │ │ ├── Arguments4Splitting.java │ │ ├── Arguments4Validator.java │ │ ├── Arguments5.java │ │ ├── Arguments5Combining.java │ │ ├── Arguments5Splitting.java │ │ ├── Arguments5Validator.java │ │ ├── Arguments6.java │ │ ├── Arguments6Combining.java │ │ ├── Arguments6Splitting.java │ │ ├── Arguments6Validator.java │ │ ├── Arguments7.java │ │ ├── Arguments7Combining.java │ │ ├── Arguments7Splitting.java │ │ ├── Arguments7Validator.java │ │ ├── Arguments8.java │ │ ├── Arguments8Combining.java │ │ ├── Arguments8Splitting.java │ │ ├── Arguments8Validator.java │ │ ├── Arguments9.java │ │ ├── Arguments9Combining.java │ │ ├── Arguments9Splitting.java │ │ ├── Arguments9Validator.java │ │ ├── ArgumentsValidators.java │ │ ├── BigDecimalValidator.java │ │ ├── BigIntegerValidator.java │ │ ├── BooleanValidator.java │ │ ├── DefaultArguments10Validator.java │ │ ├── DefaultArguments11Validator.java │ │ ├── DefaultArguments12Validator.java │ │ ├── DefaultArguments13Validator.java │ │ ├── DefaultArguments14Validator.java │ │ ├── DefaultArguments15Validator.java │ │ ├── DefaultArguments16Validator.java │ │ ├── DefaultArguments1Validator.java │ │ ├── DefaultArguments2Validator.java │ │ ├── DefaultArguments3Validator.java │ │ ├── DefaultArguments4Validator.java │ │ ├── DefaultArguments5Validator.java │ │ ├── DefaultArguments6Validator.java │ │ ├── DefaultArguments7Validator.java │ │ ├── DefaultArguments8Validator.java │ │ ├── DefaultArguments9Validator.java │ │ ├── DoubleValidator.java │ │ ├── EnumValidator.java │ │ ├── FloatValidator.java │ │ ├── InstantValidator.java │ │ ├── IntegerValidator.java │ │ ├── LocalDateTimeValidator.java │ │ ├── LocalDateValidator.java │ │ ├── LocalTimeValidator.java │ │ ├── LongValidator.java │ │ ├── ObjectValidator.java │ │ ├── OffsetDateTimeValidator.java │ │ ├── ShortValidator.java │ │ ├── StringValidator.java │ │ ├── YearMonthValidator.java │ │ ├── YearValidator.java │ │ ├── ZonedDateTimeValidator.java │ │ └── package-info.java │ │ ├── builder │ │ ├── Arguments10ValidatorBuilder.java │ │ ├── Arguments11ValidatorBuilder.java │ │ ├── Arguments12ValidatorBuilder.java │ │ ├── Arguments13ValidatorBuilder.java │ │ ├── Arguments14ValidatorBuilder.java │ │ ├── Arguments15ValidatorBuilder.java │ │ ├── Arguments16ValidatorBuilder.java │ │ ├── Arguments1ValidatorBuilder.java │ │ ├── Arguments2ValidatorBuilder.java │ │ ├── Arguments3ValidatorBuilder.java │ │ ├── Arguments4ValidatorBuilder.java │ │ ├── Arguments5ValidatorBuilder.java │ │ ├── Arguments6ValidatorBuilder.java │ │ ├── Arguments7ValidatorBuilder.java │ │ ├── Arguments8ValidatorBuilder.java │ │ ├── Arguments9ValidatorBuilder.java │ │ ├── ArgumentsValidatorBuilder.java │ │ ├── BigDecimalValidatorBuilder.java │ │ ├── BigIntegerValidatorBuilder.java │ │ ├── BooleanValidatorBuilder.java │ │ ├── ConflictStrategy.java │ │ ├── DoubleValidatorBuilder.java │ │ ├── EnumValidatorBuilder.java │ │ ├── FloatValidatorBuilder.java │ │ ├── InstantValidatorBuilder.java │ │ ├── IntegerValidatorBuilder.java │ │ ├── LocalDateTimeValidatorBuilder.java │ │ ├── LocalDateValidatorBuilder.java │ │ ├── LocalTimeValidatorBuilder.java │ │ ├── LongValidatorBuilder.java │ │ ├── ObjectValidatorBuilder.java │ │ ├── OffsetDateTimeValidatorBuilder.java │ │ ├── ShortValidatorBuilder.java │ │ ├── StringValidatorBuilder.java │ │ ├── ValidatorBuilder.java │ │ ├── ValueValidatorBuilder.java │ │ ├── YaviArguments.java │ │ ├── YearMonthValidatorBuilder.java │ │ ├── YearValidatorBuilder.java │ │ ├── ZonedDateTimeValidatorBuilder.java │ │ └── package-info.java │ │ ├── constraint │ │ ├── BigDecimalConstraint.java │ │ ├── BigIntegerConstraint.java │ │ ├── BooleanConstraint.java │ │ ├── ByteConstraint.java │ │ ├── CharSequenceConstraint.java │ │ ├── CharacterConstraint.java │ │ ├── CollectionConstraint.java │ │ ├── DoubleConstraint.java │ │ ├── EnumConstraint.java │ │ ├── FloatConstraint.java │ │ ├── InstantConstraint.java │ │ ├── IntegerConstraint.java │ │ ├── LocalDateConstraint.java │ │ ├── LocalDateTimeConstraint.java │ │ ├── LocalTimeConstraint.java │ │ ├── LongConstraint.java │ │ ├── MapConstraint.java │ │ ├── ObjectConstraint.java │ │ ├── OffsetDateTimeConstraint.java │ │ ├── ShortConstraint.java │ │ ├── YearConstraint.java │ │ ├── YearMonthConstraint.java │ │ ├── ZonedDateTimeConstraint.java │ │ ├── array │ │ │ ├── BooleanArrayConstraint.java │ │ │ ├── ByteArrayConstraint.java │ │ │ ├── CharArrayConstraint.java │ │ │ ├── DoubleArrayConstraint.java │ │ │ ├── FloatArrayConstraint.java │ │ │ ├── IntArrayConstraint.java │ │ │ ├── LongArrayConstraint.java │ │ │ ├── ObjectArrayConstraint.java │ │ │ ├── ShortArrayConstraint.java │ │ │ └── package-info.java │ │ ├── base │ │ │ ├── ChronoLocalDateConstraintBase.java │ │ │ ├── ChronoLocalDateTimeConstraintBase.java │ │ │ ├── ChronoZonedDateTimeConstraintBase.java │ │ │ ├── ConstraintBase.java │ │ │ ├── ContainerConstraintBase.java │ │ │ ├── NumericConstraintBase.java │ │ │ ├── TemporalConstraintBase.java │ │ │ └── package-info.java │ │ ├── charsequence │ │ │ ├── ByteSizeConstraint.java │ │ │ ├── CodePoints.java │ │ │ ├── CodePointsConstraint.java │ │ │ ├── Emoji.java │ │ │ ├── EmojiConstraint.java │ │ │ ├── codepoints │ │ │ │ ├── AsciiCodePoints.java │ │ │ │ ├── CompositeCodePoints.java │ │ │ │ ├── UnicodeCodePoints.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── variant │ │ │ │ ├── IdeographicVariationSequence.java │ │ │ │ ├── MongolianFreeVariationSelector.java │ │ │ │ ├── StandardizedVariationSequence.java │ │ │ │ ├── VariantOptions.java │ │ │ │ └── package-info.java │ │ ├── inetaddress │ │ │ ├── InetAddressUtils.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ └── password │ │ │ ├── CharSequencePasswordPoliciesBuilder.java │ │ │ ├── ObjectPasswordPoliciesBuilder.java │ │ │ ├── PasswordPoliciesBuilder.java │ │ │ ├── PasswordPolicy.java │ │ │ └── package-info.java │ │ ├── core │ │ ├── ApplicativeValidator.java │ │ ├── CollectionValidator.java │ │ ├── Constraint.java │ │ ├── ConstraintCondition.java │ │ ├── ConstraintContext.java │ │ ├── ConstraintGroup.java │ │ ├── ConstraintPredicate.java │ │ ├── ConstraintPredicates.java │ │ ├── ConstraintViolation.java │ │ ├── ConstraintViolations.java │ │ ├── ConstraintViolationsException.java │ │ ├── CustomConstraint.java │ │ ├── ErrorHandler.java │ │ ├── NestedCollectionValidator.java │ │ ├── NestedConstraintCondition.java │ │ ├── NestedConstraintPredicates.java │ │ ├── NestedValidator.java │ │ ├── NullAs.java │ │ ├── Validatable.java │ │ ├── Validated.java │ │ ├── Validator.java │ │ ├── ValueValidator.java │ │ ├── ViolatedArguments.java │ │ ├── ViolatedValue.java │ │ ├── ViolationDetail.java │ │ ├── ViolationMessage.java │ │ └── package-info.java │ │ ├── factory │ │ ├── BiConsumerFactory.java │ │ ├── ValidatorFactory.java │ │ ├── ValidatorFactorySupport.java │ │ └── package-info.java │ │ ├── fn │ │ ├── Combining1.java │ │ ├── Combining10.java │ │ ├── Combining11.java │ │ ├── Combining12.java │ │ ├── Combining13.java │ │ ├── Combining14.java │ │ ├── Combining15.java │ │ ├── Combining16.java │ │ ├── Combining2.java │ │ ├── Combining3.java │ │ ├── Combining4.java │ │ ├── Combining5.java │ │ ├── Combining6.java │ │ ├── Combining7.java │ │ ├── Combining8.java │ │ ├── Combining9.java │ │ ├── Function1.java │ │ ├── Function10.java │ │ ├── Function11.java │ │ ├── Function12.java │ │ ├── Function13.java │ │ ├── Function14.java │ │ ├── Function15.java │ │ ├── Function16.java │ │ ├── Function2.java │ │ ├── Function3.java │ │ ├── Function4.java │ │ ├── Function5.java │ │ ├── Function6.java │ │ ├── Function7.java │ │ ├── Function8.java │ │ ├── Function9.java │ │ ├── Functions.java │ │ ├── Pair.java │ │ ├── Validation.java │ │ ├── Validations.java │ │ └── package-info.java │ │ ├── jsr305 │ │ ├── NonNull.java │ │ ├── NonNullApi.java │ │ └── Nullable.java │ │ ├── message │ │ ├── MessageFormatter.java │ │ ├── MessageSourceMessageFormatter.java │ │ ├── SimpleMessageFormatter.java │ │ └── package-info.java │ │ ├── meta │ │ ├── BigDecimalConstraintMeta.java │ │ ├── BigIntegerConstraintMeta.java │ │ ├── BooleanConstraintMeta.java │ │ ├── ByteConstraintMeta.java │ │ ├── CharacterConstraintMeta.java │ │ ├── ConstraintArguments.java │ │ ├── ConstraintMeta.java │ │ ├── ConstraintTarget.java │ │ ├── DoubleConstraintMeta.java │ │ ├── FloatConstraintMeta.java │ │ ├── InstantConstraintMeta.java │ │ ├── IntegerConstraintMeta.java │ │ ├── LocalDateConstraintMeta.java │ │ ├── LocalDateTimeConstraintMeta.java │ │ ├── LocalTimeConstraintMeta.java │ │ ├── LongConstraintMeta.java │ │ ├── ObjectConstraintMeta.java │ │ ├── OffsetDateTimeConstraintMeta.java │ │ ├── ShortConstraintMeta.java │ │ ├── StringConstraintMeta.java │ │ ├── YearConstraintMeta.java │ │ ├── YearMonthConstraintMeta.java │ │ ├── ZonedDateTimeConstraintMeta.java │ │ └── package-info.java │ │ ├── processor │ │ ├── ConstraintMetaProcessor.java │ │ ├── ConstraintMetaTemplate.java │ │ └── package-info.java │ │ └── validator │ │ ├── Yavi.java │ │ └── package-info.java ├── kotlin │ └── am │ │ └── ik │ │ └── yavi │ │ ├── builder │ │ └── ValidatorBuilderKtDsl.kt │ │ └── fn │ │ └── ValidationExtensions.kt └── resources │ └── META-INF │ ├── native-image │ └── am.ik.yavi │ │ └── yavi │ │ └── reflect-config.json │ └── services │ └── javax.annotation.processing.Processor └── test ├── java └── am │ └── ik │ └── yavi │ ├── Address.java │ ├── Book.java │ ├── CalendarEntryLocalDate.java │ ├── CalendarEntryLocalDateTime.java │ ├── CalendarEntryLocalTime.java │ ├── Color.java │ ├── ConstraintViolationsException.java │ ├── Country.java │ ├── FormWithArray.java │ ├── FormWithCollection.java │ ├── FormWithMap.java │ ├── Message.java │ ├── NestedFormWithCollection.java │ ├── PhoneNumber.java │ ├── Range.java │ ├── User.java │ ├── arguments │ ├── ArgumentsTest.java │ ├── ArgumentsValidatorTest.java │ ├── ArgumentsValidatorsTest.java │ ├── BigDecimalValidatorTest.java │ ├── BigIntegerValidatorTest.java │ ├── BooleanValidatorTest.java │ ├── Car.java │ ├── DoubleValidatorTest.java │ ├── FloatValidatorTest.java │ ├── Gh156Test.java │ ├── IntegerValidatorTest.java │ ├── LongValidatorTest.java │ ├── MethodInvocationTest.java │ ├── ObjectValidatorTest.java │ ├── Product.java │ ├── RangeValidatorTest.java │ ├── ShortValidatorTest.java │ ├── StringValidatorTest.java │ ├── User.java │ ├── UserService.java │ └── UserValidatorTest.java │ ├── constraint │ ├── BigDecimalConstraintTest.java │ ├── BigIntegerConstraintTest.java │ ├── BooleanConstraintTest.java │ ├── ByteConstraintTest.java │ ├── CharSequenceConstraintTest.java │ ├── CharacterConstraintTest.java │ ├── CollectionConstraintTest.java │ ├── DoubleConstraintTest.java │ ├── EnumConstraintTest.java │ ├── FloatConstraintTest.java │ ├── Gh229Test.java │ ├── InstantConstraintTest.java │ ├── IntegerConstraintTest.java │ ├── LocalDateConstraintTest.java │ ├── LocalDateTimeConstraintTest.java │ ├── LocalTimeConstraintTest.java │ ├── LongConstraintTest.java │ ├── MapConstraintTest.java │ ├── ObjectConstraintTest.java │ ├── OffsetDateTimeConstraintTest.java │ ├── ShortConstraintTest.java │ ├── YearConstraintTest.java │ ├── YearMonthConstraintTest.java │ ├── ZonedDateTimeConstraintTest.java │ ├── array │ │ ├── ByteArrayConstraintTest.java │ │ ├── CharArrayConstraintTest.java │ │ ├── DoubleArrayConstraintTest.java │ │ ├── FloatArrayConstraintTest.java │ │ ├── IntArrayConstraintTest.java │ │ ├── LongArrayConstraintTest.java │ │ ├── ObjectArrayConstraintTest.java │ │ └── ShortArrayConstraintTest.java │ ├── charsequence │ │ ├── ByteSizeConstraintTest.java │ │ ├── CodePointsConstraintTest.java │ │ ├── EmojiTest.java │ │ ├── RangeTest.java │ │ └── codepoints │ │ │ └── CompositeCodePointsTest.java │ └── password │ │ ├── CharSequencePasswordConstraintTest.java │ │ └── ObjectPasswordConstraintTest.java │ ├── core │ ├── AbstractArrayValidatorTest.java │ ├── AbstractCollectionValidatorTest.java │ ├── AbstractMapValidatorTest.java │ ├── AbstractNestedValidatorTest.java │ ├── ApplicativeValidationTest.java │ ├── ArrayValidatorTest.java │ ├── BiConsumerTest.java │ ├── CastTest.java │ ├── CollectionValidatorTest.java │ ├── ConstraintContextTest.java │ ├── ConstraintGroupTest.java │ ├── ConstraintViolationTest.java │ ├── ConstraintViolationsExceptionTest.java │ ├── ConstraintViolationsTest.java │ ├── CustomValidatorTest.java │ ├── EnumValidatorTest.java │ ├── FailFastTest.java │ ├── Gh127Test.java │ ├── Gh145Test.java │ ├── Gh165Test.java │ ├── Gh168Test.java │ ├── Gh213Test.java │ ├── Gh226Test.java │ ├── Gh240Test.java │ ├── Gh249Test.java │ ├── Gh253Test.java │ ├── Gh335Test.java │ ├── Gh338Test.java │ ├── Gh432Test.java │ ├── Group.java │ ├── InlineArrayValidatorTest.java │ ├── InlineCollectionValidatorTest.java │ ├── InlineMapValidatorTest.java │ ├── InlineNestedValidatorTest.java │ ├── MapValidatorTest.java │ ├── MultiNestedCollectionValidatorTest.java │ ├── NestedConstraintConditionGh127Test.java │ ├── NestedValidatorTest.java │ ├── ValidatedTest.java │ ├── ValidatorTest.java │ └── ValueValidatorTest.java │ ├── factory │ ├── BiConsumerFactoryTest.java │ └── ValidatorFactoryTest.java │ ├── fn │ ├── FunctionsTest.java │ ├── ValidationTest.java │ └── ValidationsTest.java │ ├── message │ ├── CustomMessageFormatter.java │ ├── CustomMessageFormatterTest.java │ └── MessageSourceMessageFormatterTest.java │ ├── meta │ ├── Address.java │ ├── AllTypesBean.java │ ├── AllTypesField.java │ ├── AllTypesImmutable.java │ ├── Person.java │ ├── User.java │ ├── UserService.java │ ├── ValidatorBuilderTest.java │ ├── _AddressMeta.java │ ├── _Address_CountryMeta.java │ ├── _Address_PhoneNumberMeta.java │ ├── _AllTypesBeanMeta.java │ ├── _AllTypesFieldMeta.java │ ├── _AllTypesImmutableMeta.java │ ├── _PersonArgumentsMeta.java │ └── _UserServiceCreateUserArgumentsMeta.java │ └── processor │ └── ConstraintMetaProcessorTest.java ├── kotlin └── am │ └── ik │ └── yavi │ ├── arguments │ └── ArgumentsValidatorKotlinTest.kt │ ├── builder │ └── ValidatorBuilderKtDslTest.kt │ └── fn │ └── ValidationExtensionsTest.kt └── resources ├── emoji-test-11.txt ├── emoji-test-12.txt ├── emoji-test-14.txt └── test ├── Address.java ├── AllTypesBean.java ├── AllTypesField.java ├── AllTypesImmutable.java ├── Car.java ├── Car2.java ├── CarBean.java ├── CarField.java ├── User.java ├── UserService.java ├── _AddressMeta.java ├── _Address_CountryMeta.java ├── _Address_PhoneNumberMeta.java ├── _AllTypesBeanMeta.java ├── _AllTypesFieldMeta.java ├── _AllTypesImmutableMeta.java ├── _Car2ArgumentsMeta.java ├── _CarBeanMeta.java ├── _CarFieldMeta.java ├── _CarMeta.java └── _UserServiceCreateUserArgumentsMeta.java /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: maven 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "20:00" 8 | open-pull-requests-limit: 10 9 | ignore: 10 | - dependency-name: org.jetbrains.kotlin:kotlin-maven-plugin 11 | versions: 12 | - 1.4.30 13 | - dependency-name: org.jetbrains.kotlin:kotlin-reflect 14 | versions: 15 | - 1.4.30 16 | - dependency-name: org.jetbrains.kotlin:kotlin-stdlib 17 | versions: 18 | - 1.4.30 19 | - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core 20 | versions: 21 | - 1.4.2-native-mt 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | target 4 | credentials.yml 5 | .DS_Store 6 | .project 7 | .classpath -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/making/yavi/3b6a789d4697511edca1bc81da5987776a12e537/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /.springjavaformatconfig: -------------------------------------------------------------------------------- 1 | java-baseline=8 -------------------------------------------------------------------------------- /How-To-Release.md: -------------------------------------------------------------------------------- 1 | ``` 2 | # Merge develop to main 3 | git checkout main 4 | git merge develop 5 | ./set-release-version.sh 6 | 7 | # Create a tag and push it 8 | VERSION=$(./get-release-version.sh) 9 | git tag ${VERSION} 10 | git push origin main 11 | git push origin ${VERSION} 12 | 13 | # Merge main to develop and bump the version 14 | ./merge-main-to-develop.sh 15 | ./set-next-patch-version.sh 16 | # or 17 | ./set-next-minor-version.sh 18 | # Update REAMD 19 | git add README.md 20 | git commit -m "Update README" 21 | git push origin develop 22 | ``` -------------------------------------------------------------------------------- /docs/GettingStarted.md: -------------------------------------------------------------------------------- 1 | Moved to [https://yavi.ik.am/#getting-started](https://yavi.ik.am/#getting-started) -------------------------------------------------------------------------------- /get-release-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep '' pom.xml | head -n 1 | sed -e 's|||g' -e 's|||g' | xargs echo | sed 's/-SNAPSHOT$//' -------------------------------------------------------------------------------- /merge-main-to-develop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | git checkout main 5 | git pull origin main 6 | git checkout develop 7 | git merge main -------------------------------------------------------------------------------- /scripts/generate-function.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | n=16 4 | 5 | for i in `seq 1 ${n}`;do 6 | class="Function${i}" 7 | file="$(dirname $0)/../src/main/java/am/ik/yavi/fn/${class}.java" 8 | echo $file 9 | cat < ${file} 10 | /* 11 | * Copyright (C) 2018-2024 Toshiaki Maki 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the "License"); 14 | * you may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | package am.ik.yavi.fn; 26 | 27 | import am.ik.yavi.jsr305.Nullable; 28 | 29 | /** 30 | * Generated by 31 | * https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 32 | * 33 | * @since 0.6.0 34 | */ 35 | @FunctionalInterface 36 | public interface ${class}<$(echo $(for j in `seq 1 ${i}`;do echo -n "T${j}, ";done) | sed 's/,$//'), R> { 37 | 38 | R apply($(echo $(for j in `seq 1 ${i}`;do echo -n "@Nullable T${j} t${j}, ";done) | sed 's/,$//')); 39 | } 40 | EOF 41 | done -------------------------------------------------------------------------------- /set-next-minor-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | CURRENT_VERSION=$(./get-release-version.sh) 3 | MAJOR_VERSION=$(echo ${CURRENT_VERSION} | awk -F '.' '{print $1}' ) 4 | MINOR_VERSION=$(echo ${CURRENT_VERSION} | awk -F '.' '{print $2}' ) 5 | PATCH_VERSION=$(echo ${CURRENT_VERSION} | awk -F '.' '{print $3}' ) 6 | NEXT_MINOR_VERSION="${MAJOR_VERSION}.$((${MINOR_VERSION} + 1)).0-SNAPSHOT" 7 | 8 | ./mvnw versions:set -DnewVersion="${NEXT_MINOR_VERSION}" -DallowSnapshots -DgenerateBackupPoms=false 9 | git add pom.xml 10 | git commit -m "Bump to ${NEXT_MINOR_VERSION}" -------------------------------------------------------------------------------- /set-next-patch-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | CURRENT_VERSION=$(./get-release-version.sh) 3 | MAJOR_VERSION=$(echo ${CURRENT_VERSION} | awk -F '.' '{print $1}' ) 4 | MINOR_VERSION=$(echo ${CURRENT_VERSION} | awk -F '.' '{print $2}' ) 5 | PATCH_VERSION=$(echo ${CURRENT_VERSION} | awk -F '.' '{print $3}' ) 6 | NEXT_PATCH_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.$((${PATCH_VERSION} + 1))-SNAPSHOT" 7 | 8 | ./mvnw versions:set -DnewVersion="${NEXT_PATCH_VERSION}" -DallowSnapshots -DgenerateBackupPoms=false 9 | git add pom.xml 10 | git commit -m "Bump to ${NEXT_PATCH_VERSION}" -------------------------------------------------------------------------------- /set-release-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | CURRENT_VERSION=$(./get-release-version.sh) 3 | 4 | ./mvnw versions:set -DnewVersion=${CURRENT_VERSION} -DgenerateBackupPoms=false 5 | git add pom.xml 6 | git commit -m "Bump to ${CURRENT_VERSION}" -------------------------------------------------------------------------------- /src/etc/header-definition.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /* 5 | * 6 | */ 7 | true 8 | false 9 | (\s|\t)*/\*.*$ 10 | 11 | .*\*/(\s|\t)*$ 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/etc/header.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2018-2025 Toshiaki Maki 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/BigDecimalValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.math.BigDecimal; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.core.Validator; 22 | import am.ik.yavi.fn.Function1; 23 | 24 | /** 25 | * @since 0.7.0 26 | */ 27 | public class BigDecimalValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public BigDecimalValidator map(Function mapper) { 31 | return new BigDecimalValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public BigDecimalValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/BigIntegerValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.math.BigInteger; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.core.Validator; 22 | import am.ik.yavi.fn.Function1; 23 | 24 | /** 25 | * @since 0.7.0 26 | */ 27 | public class BigIntegerValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public BigIntegerValidator map(Function mapper) { 31 | return new BigIntegerValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public BigIntegerValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/BooleanValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.7.0 25 | */ 26 | public class BooleanValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public BooleanValidator map(Function mapper) { 30 | return new BooleanValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public BooleanValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/DoubleValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.7.0 25 | */ 26 | public class DoubleValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public DoubleValidator map(Function mapper) { 30 | return new DoubleValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public DoubleValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/EnumValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.14.0 25 | */ 26 | public class EnumValidator, T> extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public EnumValidator map(Function mapper) { 30 | return new EnumValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public EnumValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/FloatValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.7.0 25 | */ 26 | public class FloatValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public FloatValidator map(Function mapper) { 30 | return new FloatValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public FloatValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/InstantValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.time.Instant; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.core.Validator; 22 | import am.ik.yavi.fn.Function1; 23 | 24 | /** 25 | * @since 0.10.0 26 | */ 27 | public class InstantValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public InstantValidator map(Function mapper) { 31 | return new InstantValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public InstantValidator(Validator> validator, Function1 mapper) { 35 | super(validator, mapper); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/IntegerValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.7.0 25 | */ 26 | public class IntegerValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public IntegerValidator map(Function mapper) { 30 | return new IntegerValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public IntegerValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/LocalDateTimeValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import am.ik.yavi.core.Validator; 19 | import am.ik.yavi.fn.Function1; 20 | 21 | import java.time.LocalDateTime; 22 | import java.util.function.Function; 23 | 24 | /** 25 | * @since 0.10.0 26 | */ 27 | public class LocalDateTimeValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public LocalDateTimeValidator map(Function mapper) { 31 | return new LocalDateTimeValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public LocalDateTimeValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/LocalDateValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import am.ik.yavi.core.Validator; 19 | import am.ik.yavi.fn.Function1; 20 | 21 | import java.time.LocalDate; 22 | import java.util.function.Function; 23 | 24 | /** 25 | * @since 0.10.0 26 | */ 27 | public class LocalDateValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public LocalDateValidator map(Function mapper) { 31 | return new LocalDateValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public LocalDateValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/LocalTimeValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import am.ik.yavi.core.Validator; 19 | import am.ik.yavi.fn.Function1; 20 | 21 | import java.time.LocalTime; 22 | import java.util.function.Function; 23 | 24 | /** 25 | * @since 0.10.0 26 | */ 27 | public class LocalTimeValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public LocalTimeValidator map(Function mapper) { 31 | return new LocalTimeValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public LocalTimeValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/LongValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.7.0 25 | */ 26 | public class LongValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public LongValidator map(Function mapper) { 30 | return new LongValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public LongValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/ObjectValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.8.0 25 | */ 26 | public class ObjectValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public ObjectValidator map(Function mapper) { 30 | return new ObjectValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public ObjectValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/OffsetDateTimeValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.time.OffsetDateTime; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.core.Validator; 22 | import am.ik.yavi.fn.Function1; 23 | 24 | /** 25 | * @since 0.10.0 26 | */ 27 | public class OffsetDateTimeValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public OffsetDateTimeValidator map(Function mapper) { 31 | return new OffsetDateTimeValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public OffsetDateTimeValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/ShortValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.7.0 25 | */ 26 | public class ShortValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public ShortValidator map(Function mapper) { 30 | return new ShortValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public ShortValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/StringValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.Validator; 21 | import am.ik.yavi.fn.Function1; 22 | 23 | /** 24 | * @since 0.7.0 25 | */ 26 | public class StringValidator extends DefaultArguments1Validator { 27 | 28 | @Override 29 | public StringValidator map(Function mapper) { 30 | return new StringValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 31 | } 32 | 33 | public StringValidator(Validator> validator, Function1 mapper) { 34 | super(validator, mapper); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/YearMonthValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.time.YearMonth; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.core.Validator; 22 | import am.ik.yavi.fn.Function1; 23 | 24 | /** 25 | * @since 0.11.0 26 | */ 27 | public class YearMonthValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public YearMonthValidator map(Function mapper) { 31 | return new YearMonthValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public YearMonthValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/YearValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import java.time.Year; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.core.Validator; 22 | import am.ik.yavi.fn.Function1; 23 | 24 | /** 25 | * @since 0.11.0 26 | */ 27 | public class YearValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public YearValidator map(Function mapper) { 31 | return new YearValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public YearValidator(Validator> validator, Function1 mapper) { 35 | super(validator, mapper); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/ZonedDateTimeValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import am.ik.yavi.core.Validator; 19 | import am.ik.yavi.fn.Function1; 20 | 21 | import java.time.ZonedDateTime; 22 | import java.util.function.Function; 23 | 24 | /** 25 | * @since 0.10.0 26 | */ 27 | public class ZonedDateTimeValidator extends DefaultArguments1Validator { 28 | 29 | @Override 30 | public ZonedDateTimeValidator map(Function mapper) { 31 | return new ZonedDateTimeValidator<>(super.validator, s -> mapper.apply(super.mapper.apply(s))); 32 | } 33 | 34 | public ZonedDateTimeValidator(Validator> validator, 35 | Function1 mapper) { 36 | super(validator, mapper); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/arguments/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.arguments; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/builder/ValueValidatorBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.builder; 17 | 18 | import java.util.function.Function; 19 | 20 | import am.ik.yavi.core.ValueValidator; 21 | 22 | /** 23 | * Builder for ValueValidator 24 | * 25 | * @param argument type 26 | * @param result type 27 | * @since 0.14.0 28 | */ 29 | public interface ValueValidatorBuilder { 30 | 31 | ValueValidator build(); 32 | 33 | ValueValidator build(Function mapper); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/builder/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.builder; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/BooleanConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import static am.ik.yavi.core.NullAs.VALID; 19 | import static am.ik.yavi.core.ViolationMessage.Default.BOOLEAN_IS_FALSE; 20 | import static am.ik.yavi.core.ViolationMessage.Default.BOOLEAN_IS_TRUE; 21 | 22 | import am.ik.yavi.constraint.base.ConstraintBase; 23 | import am.ik.yavi.core.ConstraintPredicate; 24 | 25 | public class BooleanConstraint extends ConstraintBase> { 26 | 27 | @Override 28 | public BooleanConstraint cast() { 29 | return this; 30 | } 31 | 32 | public BooleanConstraint isFalse() { 33 | this.predicates().add(ConstraintPredicate.of(x -> !x, BOOLEAN_IS_FALSE, () -> new Object[] {}, VALID)); 34 | return this; 35 | } 36 | 37 | public BooleanConstraint isTrue() { 38 | this.predicates().add(ConstraintPredicate.of(x -> x, BOOLEAN_IS_TRUE, () -> new Object[] {}, VALID)); 39 | return this; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/ByteConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.function.Predicate; 19 | 20 | import am.ik.yavi.constraint.base.NumericConstraintBase; 21 | 22 | public class ByteConstraint extends NumericConstraintBase> { 23 | 24 | @Override 25 | public ByteConstraint cast() { 26 | return this; 27 | } 28 | 29 | @Override 30 | protected Predicate isGreaterThan(Byte min) { 31 | return x -> x > min; 32 | } 33 | 34 | @Override 35 | protected Predicate isGreaterThanOrEqual(Byte min) { 36 | return x -> x >= min; 37 | } 38 | 39 | @Override 40 | protected Predicate isLessThan(Byte max) { 41 | return x -> x < max; 42 | } 43 | 44 | @Override 45 | protected Predicate isLessThanOrEqual(Byte max) { 46 | return x -> x <= max; 47 | } 48 | 49 | @Override 50 | protected Byte zeroValue() { 51 | return 0; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/CharacterConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.function.Predicate; 19 | 20 | import am.ik.yavi.constraint.base.NumericConstraintBase; 21 | 22 | public class CharacterConstraint extends NumericConstraintBase> { 23 | 24 | @Override 25 | public CharacterConstraint cast() { 26 | return this; 27 | } 28 | 29 | @Override 30 | protected Predicate isGreaterThan(Character min) { 31 | return x -> x > min; 32 | } 33 | 34 | @Override 35 | protected Predicate isGreaterThanOrEqual(Character min) { 36 | return x -> x >= min; 37 | } 38 | 39 | @Override 40 | protected Predicate isLessThan(Character max) { 41 | return x -> x < max; 42 | } 43 | 44 | @Override 45 | protected Predicate isLessThanOrEqual(Character max) { 46 | return x -> x <= max; 47 | } 48 | 49 | @Override 50 | protected Character zeroValue() { 51 | return Character.MIN_VALUE; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/DoubleConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.function.Predicate; 19 | 20 | import am.ik.yavi.constraint.base.NumericConstraintBase; 21 | 22 | public class DoubleConstraint extends NumericConstraintBase> { 23 | 24 | @Override 25 | public DoubleConstraint cast() { 26 | return this; 27 | } 28 | 29 | @Override 30 | protected Predicate isGreaterThan(Double min) { 31 | return x -> x > min; 32 | } 33 | 34 | @Override 35 | protected Predicate isGreaterThanOrEqual(Double min) { 36 | return x -> x >= min; 37 | } 38 | 39 | @Override 40 | protected Predicate isLessThan(Double max) { 41 | return x -> x < max; 42 | } 43 | 44 | @Override 45 | protected Predicate isLessThanOrEqual(Double max) { 46 | return x -> x <= max; 47 | } 48 | 49 | @Override 50 | protected Double zeroValue() { 51 | return 0.0; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/EnumConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import am.ik.yavi.constraint.base.ConstraintBase; 19 | 20 | import java.util.Arrays; 21 | import java.util.EnumSet; 22 | 23 | /** 24 | * class for enum constraints 25 | * 26 | * @since 0.14.0 27 | */ 28 | public class EnumConstraint> extends ConstraintBase> { 29 | 30 | @Override 31 | public EnumConstraint cast() { 32 | return this; 33 | } 34 | 35 | @SafeVarargs 36 | public final EnumConstraint oneOf(E... values) throws IllegalArgumentException { 37 | if (values.length == 0) { 38 | throw new IllegalArgumentException("oneOf must accept at least one value"); 39 | } 40 | 41 | EnumSet enumSet = EnumSet.copyOf(Arrays.asList(values)); 42 | 43 | return super.oneOf(enumSet); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/FloatConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.function.Predicate; 19 | 20 | import am.ik.yavi.constraint.base.NumericConstraintBase; 21 | 22 | public class FloatConstraint extends NumericConstraintBase> { 23 | 24 | @Override 25 | public FloatConstraint cast() { 26 | return this; 27 | } 28 | 29 | @Override 30 | protected Predicate isGreaterThan(Float min) { 31 | return x -> x > min; 32 | } 33 | 34 | @Override 35 | protected Predicate isGreaterThanOrEqual(Float min) { 36 | return x -> x >= min; 37 | } 38 | 39 | @Override 40 | protected Predicate isLessThan(Float max) { 41 | return x -> x < max; 42 | } 43 | 44 | @Override 45 | protected Predicate isLessThanOrEqual(Float max) { 46 | return x -> x <= max; 47 | } 48 | 49 | @Override 50 | protected Float zeroValue() { 51 | return 0f; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/InstantConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.Instant; 20 | 21 | import am.ik.yavi.constraint.base.TemporalConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on Instant. 25 | * 26 | * @since 0.10.0 27 | */ 28 | public class InstantConstraint extends TemporalConstraintBase> { 29 | 30 | @Override 31 | protected boolean isAfter(Instant a, Instant b) { 32 | return a.isAfter(b); 33 | } 34 | 35 | @Override 36 | protected boolean isBefore(Instant a, Instant b) { 37 | return a.isBefore(b); 38 | } 39 | 40 | @Override 41 | protected Instant getNow(Clock clock) { 42 | return Instant.now(clock); 43 | } 44 | 45 | @Override 46 | public InstantConstraint cast() { 47 | return this; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/IntegerConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.function.Predicate; 19 | 20 | import am.ik.yavi.constraint.base.NumericConstraintBase; 21 | 22 | public class IntegerConstraint extends NumericConstraintBase> { 23 | 24 | @Override 25 | public IntegerConstraint cast() { 26 | return this; 27 | } 28 | 29 | @Override 30 | protected Predicate isGreaterThan(Integer min) { 31 | return x -> x > min; 32 | } 33 | 34 | @Override 35 | protected Predicate isGreaterThanOrEqual(Integer min) { 36 | return x -> x >= min; 37 | } 38 | 39 | @Override 40 | protected Predicate isLessThan(Integer max) { 41 | return x -> x < max; 42 | } 43 | 44 | @Override 45 | protected Predicate isLessThanOrEqual(Integer max) { 46 | return x -> x <= max; 47 | } 48 | 49 | @Override 50 | protected Integer zeroValue() { 51 | return 0; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/LocalDateConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.LocalDate; 20 | 21 | import am.ik.yavi.constraint.base.ChronoLocalDateConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on LocalDate. 25 | * 26 | * @author Diego Krupitza 27 | * @since 0.10.0 28 | */ 29 | public class LocalDateConstraint extends ChronoLocalDateConstraintBase> { 30 | 31 | @Override 32 | public LocalDateConstraint cast() { 33 | return this; 34 | } 35 | 36 | @Override 37 | protected LocalDate getNow(Clock clock) { 38 | return LocalDate.now(clock); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/LocalDateTimeConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.LocalDateTime; 20 | 21 | import am.ik.yavi.constraint.base.ChronoLocalDateTimeConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on LocalDateTime. 25 | * 26 | * @author Diego Krupitza 27 | * @since 0.10.0 28 | */ 29 | public class LocalDateTimeConstraint 30 | extends ChronoLocalDateTimeConstraintBase> { 31 | 32 | @Override 33 | public LocalDateTimeConstraint cast() { 34 | return this; 35 | } 36 | 37 | @Override 38 | protected LocalDateTime getNow(Clock clock) { 39 | return LocalDateTime.now(clock); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/LocalTimeConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.LocalTime; 20 | 21 | import am.ik.yavi.constraint.base.TemporalConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on LocalTime. 25 | * 26 | * @author Diego Krupitza 27 | * @since 0.10.0 28 | */ 29 | public class LocalTimeConstraint extends TemporalConstraintBase> { 30 | 31 | @Override 32 | protected boolean isAfter(LocalTime a, LocalTime b) { 33 | return a.isAfter(b); 34 | } 35 | 36 | @Override 37 | protected boolean isBefore(LocalTime a, LocalTime b) { 38 | return a.isBefore(b); 39 | } 40 | 41 | @Override 42 | protected LocalTime getNow(Clock clock) { 43 | return LocalTime.now(clock); 44 | } 45 | 46 | @Override 47 | public LocalTimeConstraint cast() { 48 | return this; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/LongConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.function.Predicate; 19 | 20 | import am.ik.yavi.constraint.base.NumericConstraintBase; 21 | 22 | public class LongConstraint extends NumericConstraintBase> { 23 | 24 | @Override 25 | public LongConstraint cast() { 26 | return this; 27 | } 28 | 29 | @Override 30 | protected Predicate isGreaterThan(Long min) { 31 | return x -> x > min; 32 | } 33 | 34 | @Override 35 | protected Predicate isGreaterThanOrEqual(Long min) { 36 | return x -> x >= min; 37 | } 38 | 39 | @Override 40 | protected Predicate isLessThan(Long max) { 41 | return x -> x < max; 42 | } 43 | 44 | @Override 45 | protected Predicate isLessThanOrEqual(Long max) { 46 | return x -> x <= max; 47 | } 48 | 49 | @Override 50 | protected Long zeroValue() { 51 | return 0L; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/ObjectConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.List; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.constraint.base.ConstraintBase; 22 | import am.ik.yavi.constraint.password.ObjectPasswordPoliciesBuilder; 23 | import am.ik.yavi.core.ConstraintPredicate; 24 | 25 | public class ObjectConstraint extends ConstraintBase> { 26 | 27 | @Override 28 | public ObjectConstraint cast() { 29 | return this; 30 | } 31 | 32 | /** 33 | * @since 0.7.0 34 | */ 35 | public ObjectConstraint password( 36 | Function, List>> builder) { 37 | final List> predicates = builder.apply(new ObjectPasswordPoliciesBuilder<>()); 38 | this.predicates().addAll(predicates); 39 | return this; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/OffsetDateTimeConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.OffsetDateTime; 20 | 21 | import am.ik.yavi.constraint.base.TemporalConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on OffsetDateTime. 25 | * 26 | * @since 0.10.0 27 | */ 28 | public class OffsetDateTimeConstraint 29 | extends TemporalConstraintBase> { 30 | 31 | @Override 32 | protected boolean isAfter(OffsetDateTime a, OffsetDateTime b) { 33 | return a.isAfter(b); 34 | } 35 | 36 | @Override 37 | protected boolean isBefore(OffsetDateTime a, OffsetDateTime b) { 38 | return a.isBefore(b); 39 | } 40 | 41 | @Override 42 | protected OffsetDateTime getNow(Clock clock) { 43 | return OffsetDateTime.now(clock); 44 | } 45 | 46 | @Override 47 | public OffsetDateTimeConstraint cast() { 48 | return this; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/ShortConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.util.function.Predicate; 19 | 20 | import am.ik.yavi.constraint.base.NumericConstraintBase; 21 | 22 | public class ShortConstraint extends NumericConstraintBase> { 23 | 24 | @Override 25 | public ShortConstraint cast() { 26 | return this; 27 | } 28 | 29 | @Override 30 | protected Predicate isGreaterThan(Short min) { 31 | return x -> x > min; 32 | } 33 | 34 | @Override 35 | protected Predicate isGreaterThanOrEqual(Short min) { 36 | return x -> x >= min; 37 | } 38 | 39 | @Override 40 | protected Predicate isLessThan(Short max) { 41 | return x -> x < max; 42 | } 43 | 44 | @Override 45 | protected Predicate isLessThanOrEqual(Short max) { 46 | return x -> x <= max; 47 | } 48 | 49 | @Override 50 | protected Short zeroValue() { 51 | return 0; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/YearConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.Year; 20 | 21 | import am.ik.yavi.constraint.base.TemporalConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on Year. 25 | * 26 | * @since 0.11.0 27 | */ 28 | public class YearConstraint extends TemporalConstraintBase> { 29 | 30 | @Override 31 | protected boolean isAfter(Year a, Year b) { 32 | return a.isAfter(b); 33 | } 34 | 35 | @Override 36 | protected boolean isBefore(Year a, Year b) { 37 | return a.isBefore(b); 38 | } 39 | 40 | @Override 41 | protected Year getNow(Clock clock) { 42 | return Year.now(clock); 43 | } 44 | 45 | @Override 46 | public YearConstraint cast() { 47 | return this; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/YearMonthConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.YearMonth; 20 | 21 | import am.ik.yavi.constraint.base.TemporalConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on YearMonth. 25 | * 26 | * @since 0.11.0 27 | */ 28 | public class YearMonthConstraint extends TemporalConstraintBase> { 29 | 30 | @Override 31 | protected boolean isAfter(YearMonth a, YearMonth b) { 32 | return a.isAfter(b); 33 | } 34 | 35 | @Override 36 | protected boolean isBefore(YearMonth a, YearMonth b) { 37 | return a.isBefore(b); 38 | } 39 | 40 | @Override 41 | protected YearMonth getNow(Clock clock) { 42 | return YearMonth.now(clock); 43 | } 44 | 45 | @Override 46 | public YearMonthConstraint cast() { 47 | return this; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/ZonedDateTimeConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import java.time.Clock; 19 | import java.time.ZonedDateTime; 20 | 21 | import am.ik.yavi.constraint.base.ChronoZonedDateTimeConstraintBase; 22 | 23 | /** 24 | * This is the actual class for constraints on ZonedDateTime. 25 | * 26 | * @author Diego Krupitza 27 | * @since 0.10.0 28 | */ 29 | public class ZonedDateTimeConstraint 30 | extends ChronoZonedDateTimeConstraintBase> { 31 | 32 | @Override 33 | protected ZonedDateTime getNow(Clock clock) { 34 | return ZonedDateTime.now(clock); 35 | } 36 | 37 | @Override 38 | public ZonedDateTimeConstraint cast() { 39 | return this; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/array/ByteArrayConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.array; 17 | 18 | import java.util.function.ToIntFunction; 19 | 20 | import static am.ik.yavi.core.NullAs.VALID; 21 | import static am.ik.yavi.core.ViolationMessage.Default.ARRAY_CONTAINS; 22 | 23 | import am.ik.yavi.constraint.base.ContainerConstraintBase; 24 | import am.ik.yavi.core.ConstraintPredicate; 25 | 26 | public class ByteArrayConstraint extends ContainerConstraintBase> { 27 | 28 | @Override 29 | public ByteArrayConstraint cast() { 30 | return this; 31 | } 32 | 33 | public ByteArrayConstraint contains(byte v) { 34 | this.predicates().add(ConstraintPredicate.of(x -> { 35 | for (byte e : x) { 36 | if (e == v) { 37 | return true; 38 | } 39 | } 40 | return false; 41 | }, ARRAY_CONTAINS, () -> new Object[] { v }, VALID)); 42 | return this; 43 | } 44 | 45 | @Override 46 | protected ToIntFunction size() { 47 | return x -> x.length; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/array/DoubleArrayConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.array; 17 | 18 | import java.util.Arrays; 19 | import java.util.function.ToIntFunction; 20 | 21 | import static am.ik.yavi.core.NullAs.VALID; 22 | import static am.ik.yavi.core.ViolationMessage.Default.ARRAY_CONTAINS; 23 | 24 | import am.ik.yavi.constraint.base.ContainerConstraintBase; 25 | import am.ik.yavi.core.ConstraintPredicate; 26 | 27 | public class DoubleArrayConstraint extends ContainerConstraintBase> { 28 | 29 | @Override 30 | public DoubleArrayConstraint cast() { 31 | return this; 32 | } 33 | 34 | public DoubleArrayConstraint contains(double v) { 35 | this.predicates() 36 | .add(ConstraintPredicate.of(x -> Arrays.stream(x).anyMatch(e -> e == v), ARRAY_CONTAINS, 37 | () -> new Object[] { v }, VALID)); 38 | return this; 39 | } 40 | 41 | @Override 42 | protected ToIntFunction size() { 43 | return x -> x.length; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/array/IntArrayConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.array; 17 | 18 | import java.util.Arrays; 19 | import java.util.function.ToIntFunction; 20 | 21 | import static am.ik.yavi.core.NullAs.VALID; 22 | import static am.ik.yavi.core.ViolationMessage.Default.ARRAY_CONTAINS; 23 | 24 | import am.ik.yavi.constraint.base.ContainerConstraintBase; 25 | import am.ik.yavi.core.ConstraintPredicate; 26 | 27 | public class IntArrayConstraint extends ContainerConstraintBase> { 28 | 29 | @Override 30 | public IntArrayConstraint cast() { 31 | return this; 32 | } 33 | 34 | public IntArrayConstraint contains(int v) { 35 | this.predicates() 36 | .add(ConstraintPredicate.of(x -> Arrays.stream(x).anyMatch(e -> e == v), ARRAY_CONTAINS, 37 | () -> new Object[] { v }, VALID)); 38 | return this; 39 | } 40 | 41 | @Override 42 | protected ToIntFunction size() { 43 | return x -> x.length; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/array/LongArrayConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.array; 17 | 18 | import java.util.Arrays; 19 | import java.util.function.ToIntFunction; 20 | 21 | import static am.ik.yavi.core.NullAs.VALID; 22 | import static am.ik.yavi.core.ViolationMessage.Default.ARRAY_CONTAINS; 23 | 24 | import am.ik.yavi.constraint.base.ContainerConstraintBase; 25 | import am.ik.yavi.core.ConstraintPredicate; 26 | 27 | public class LongArrayConstraint extends ContainerConstraintBase> { 28 | 29 | @Override 30 | public LongArrayConstraint cast() { 31 | return this; 32 | } 33 | 34 | public LongArrayConstraint contains(long v) { 35 | this.predicates() 36 | .add(ConstraintPredicate.of(x -> Arrays.stream(x).anyMatch(e -> e == v), ARRAY_CONTAINS, 37 | () -> new Object[] { v }, VALID)); 38 | return this; 39 | } 40 | 41 | @Override 42 | protected ToIntFunction size() { 43 | return x -> x.length; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/array/ObjectArrayConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.array; 17 | 18 | import java.util.Arrays; 19 | import java.util.function.ToIntFunction; 20 | 21 | import static am.ik.yavi.core.NullAs.VALID; 22 | import static am.ik.yavi.core.ViolationMessage.Default.ARRAY_CONTAINS; 23 | 24 | import am.ik.yavi.constraint.base.ContainerConstraintBase; 25 | import am.ik.yavi.core.ConstraintPredicate; 26 | 27 | public class ObjectArrayConstraint extends ContainerConstraintBase> { 28 | 29 | @Override 30 | public ObjectArrayConstraint cast() { 31 | return this; 32 | } 33 | 34 | public ObjectArrayConstraint contains(E s) { 35 | this.predicates() 36 | .add(ConstraintPredicate.of(x -> Arrays.asList(x).contains(s), ARRAY_CONTAINS, () -> new Object[] { s }, 37 | VALID)); 38 | return this; 39 | } 40 | 41 | @Override 42 | protected ToIntFunction size() { 43 | return x -> x.length; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/array/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint.array; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/base/ChronoLocalDateConstraintBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.base; 17 | 18 | import java.time.chrono.ChronoLocalDate; 19 | 20 | import am.ik.yavi.core.Constraint; 21 | 22 | /** 23 | * This is the base class for constraints on ChronoLocalDate. 24 | * 25 | * @author Diego Krupitza 26 | * @since 0.10.0 27 | */ 28 | public abstract class ChronoLocalDateConstraintBase> 29 | extends TemporalConstraintBase { 30 | 31 | @Override 32 | protected boolean isAfter(V a, V b) { 33 | return a.isAfter(b); 34 | } 35 | 36 | @Override 37 | protected boolean isBefore(V a, V b) { 38 | return a.isBefore(b); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/base/ChronoLocalDateTimeConstraintBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.base; 17 | 18 | import java.time.chrono.ChronoLocalDateTime; 19 | 20 | import am.ik.yavi.core.Constraint; 21 | 22 | /** 23 | * This is the base class for constraints on ChronoLocalDateTime. 24 | * 25 | * @author Diego Krupitza 26 | * @since 0.10.0 27 | */ 28 | public abstract class ChronoLocalDateTimeConstraintBase, C extends Constraint> 29 | extends TemporalConstraintBase { 30 | 31 | @Override 32 | protected boolean isAfter(V a, V b) { 33 | return a.isAfter(b); 34 | } 35 | 36 | @Override 37 | protected boolean isBefore(V a, V b) { 38 | return a.isBefore(b); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/base/ChronoZonedDateTimeConstraintBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.base; 17 | 18 | import java.time.chrono.ChronoZonedDateTime; 19 | 20 | import am.ik.yavi.core.Constraint; 21 | 22 | /** 23 | * This is the base class for constraints on ChronoZonedDateTime. 24 | * 25 | * @author Diego Krupitza 26 | * @since 0.10.0 27 | */ 28 | public abstract class ChronoZonedDateTimeConstraintBase, C extends Constraint> 29 | extends TemporalConstraintBase { 30 | 31 | @Override 32 | protected boolean isAfter(V a, V b) { 33 | return a.isAfter(b); 34 | } 35 | 36 | @Override 37 | protected boolean isBefore(V a, V b) { 38 | return a.isBefore(b); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/base/ConstraintBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.base; 17 | 18 | import java.util.Deque; 19 | import java.util.LinkedList; 20 | 21 | import am.ik.yavi.core.Constraint; 22 | import am.ik.yavi.core.ConstraintPredicate; 23 | 24 | public abstract class ConstraintBase> implements Constraint { 25 | 26 | private final Deque> predicates = new LinkedList<>(); 27 | 28 | @Override 29 | public Deque> predicates() { 30 | return this.predicates; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/base/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint.base; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/charsequence/codepoints/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint.charsequence.codepoints; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/charsequence/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint.charsequence; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/charsequence/variant/IdeographicVariationSequence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.charsequence.variant; 17 | 18 | public enum IdeographicVariationSequence { 19 | 20 | IGNORE(true), NOT_IGNORE(false); 21 | 22 | public static final String RANGE = new String(new int[] { 0xE0100 }, 0, 1) + "-" 23 | + new String(new int[] { 0xE01EF }, 0, 1); 24 | 25 | private final boolean ignore; 26 | 27 | IdeographicVariationSequence(boolean ignore) { 28 | this.ignore = ignore; 29 | } 30 | 31 | public boolean ignore() { 32 | return this.ignore; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/charsequence/variant/MongolianFreeVariationSelector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.charsequence.variant; 17 | 18 | public enum MongolianFreeVariationSelector { 19 | 20 | IGNORE(true), NOT_IGNORE(false); 21 | 22 | public static final String RANGE = "\u180B-\u180D"; 23 | 24 | private final boolean ignore; 25 | 26 | MongolianFreeVariationSelector(boolean ignore) { 27 | this.ignore = ignore; 28 | } 29 | 30 | public boolean ignore() { 31 | return this.ignore; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/charsequence/variant/StandardizedVariationSequence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.charsequence.variant; 17 | 18 | public enum StandardizedVariationSequence { 19 | 20 | IGNORE(true), NOT_IGNORE(false); 21 | 22 | public static final String RANGE = "\uFE00-\uFE0F"; 23 | 24 | private final boolean ignore; 25 | 26 | StandardizedVariationSequence(boolean ignore) { 27 | this.ignore = ignore; 28 | } 29 | 30 | public boolean ignore() { 31 | return this.ignore; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/charsequence/variant/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint.charsequence.variant; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/inetaddress/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint.inetaddress; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/password/ObjectPasswordPoliciesBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.password; 17 | 18 | /** 19 | * @since 0.7.0 20 | */ 21 | public class ObjectPasswordPoliciesBuilder 22 | extends PasswordPoliciesBuilder> { 23 | 24 | @Override 25 | protected ObjectPasswordPoliciesBuilder cast() { 26 | return this; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/constraint/password/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.constraint.password; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/ApplicativeValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | /** 19 | * Applicative validator class 20 | * 21 | * @param Target class 22 | * @since 0.6.0 23 | */ 24 | @FunctionalInterface 25 | public interface ApplicativeValidator extends ValueValidator { 26 | 27 | } -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/CollectionValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.Collection; 19 | import java.util.function.Function; 20 | 21 | public class CollectionValidator, E> { 22 | 23 | private final String name; 24 | 25 | private final Function toCollection; 26 | 27 | private final Validator validator; 28 | 29 | public CollectionValidator(Function toCollection, String name, Validator validator) { 30 | this.toCollection = toCollection; 31 | this.name = name; 32 | this.validator = validator; 33 | } 34 | 35 | public String name() { 36 | return this.name; 37 | } 38 | 39 | public Function toCollection() { 40 | return this.toCollection; 41 | } 42 | 43 | public Validator validator() { 44 | return this.validator; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/ConstraintCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.function.BiPredicate; 19 | 20 | @FunctionalInterface 21 | public interface ConstraintCondition extends BiPredicate { 22 | 23 | /** 24 | * @since 0.11.0 25 | */ 26 | static ConstraintCondition hasAttribute(String key) { 27 | return (t, context) -> context.attribute(key).exists(); 28 | } 29 | 30 | /** 31 | * @since 0.11.0 32 | */ 33 | static ConstraintCondition hasAttributeWithValue(String key, Object value) { 34 | return (t, context) -> context.attribute(key).isEqualTo(value); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/ConstraintPredicates.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.Deque; 19 | import java.util.function.Function; 20 | 21 | public class ConstraintPredicates { 22 | 23 | private final String name; 24 | 25 | private final Deque> predicates; 26 | 27 | private final Function toValue; 28 | 29 | public ConstraintPredicates(Function toValue, String name, Deque> predicates) { 30 | this.toValue = toValue; 31 | this.name = name; 32 | this.predicates = predicates; 33 | } 34 | 35 | public final String name() { 36 | return this.name; 37 | } 38 | 39 | public final Deque> predicates() { 40 | return this.predicates; 41 | } 42 | 43 | public final Function toValue() { 44 | return this.toValue; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/CustomConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.Objects; 19 | import java.util.function.Predicate; 20 | 21 | import am.ik.yavi.jsr305.Nullable; 22 | 23 | public interface CustomConstraint extends Predicate, ViolationMessage, ViolatedArguments { 24 | 25 | Objects[] EMPTY_ARRAY = new Objects[0]; 26 | 27 | @Override 28 | default Object[] arguments(@Nullable V violatedValue) { 29 | return EMPTY_ARRAY; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/ErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | /** 19 | * @param error type 20 | * @since 0.13.0 21 | */ 22 | public interface ErrorHandler { 23 | 24 | void handleError(E errors, String name, String messageKey, Object[] args, String defaultMessage); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/NestedCollectionValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.Collection; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.jsr305.Nullable; 22 | 23 | public class NestedCollectionValidator, E, N> extends CollectionValidator { 24 | 25 | private final Function nested; 26 | 27 | public NestedCollectionValidator(Function toCollection, String name, Validator validator, 28 | Function nested) { 29 | super(toCollection, name, validator); 30 | this.nested = nested; 31 | } 32 | 33 | @Nullable 34 | public N nestedCollection(T target) { 35 | return nested.apply(target); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/NestedConstraintCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.function.Function; 19 | 20 | public class NestedConstraintCondition implements ConstraintCondition { 21 | 22 | private final Function nested; 23 | 24 | private final ConstraintCondition constraintCondition; 25 | 26 | public NestedConstraintCondition(Function nested, ConstraintCondition constraintCondition) { 27 | this.nested = nested; 28 | this.constraintCondition = constraintCondition; 29 | } 30 | 31 | @Override 32 | public boolean test(T t, ConstraintContext constraintContext) { 33 | final N n = this.nested.apply(t); 34 | if (n == null) { 35 | return false; 36 | } 37 | 38 | return this.constraintCondition.test(n, constraintContext); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/NestedConstraintPredicates.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.Deque; 19 | import java.util.function.Function; 20 | 21 | import am.ik.yavi.jsr305.Nullable; 22 | 23 | public class NestedConstraintPredicates extends ConstraintPredicates { 24 | 25 | private final Function nested; 26 | 27 | private final boolean failFast; 28 | 29 | public NestedConstraintPredicates(Function toValue, String name, 30 | Deque> constraintPredicates, Function nested, boolean failFast) { 31 | super(toValue, name, constraintPredicates); 32 | this.nested = nested; 33 | this.failFast = failFast; 34 | } 35 | 36 | @Nullable 37 | public N nestedValue(T target) { 38 | return nested.apply(target); 39 | } 40 | 41 | /** 42 | * Returns whether it is failFast. 43 | * @return whether it is failFast 44 | * @since 0.13.0 45 | */ 46 | public boolean isFailFast() { 47 | return this.failFast; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/NullAs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | public enum NullAs { 19 | 20 | INVALID(false), VALID(true); 21 | 22 | private final boolean skipNull; 23 | 24 | NullAs(boolean skipNull) { 25 | this.skipNull = skipNull; 26 | } 27 | 28 | public boolean skipNull() { 29 | return this.skipNull; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/ViolatedValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.Objects; 19 | 20 | import am.ik.yavi.jsr305.Nullable; 21 | 22 | public class ViolatedValue { 23 | 24 | private final Object value; 25 | 26 | public ViolatedValue(@Nullable Object value) { 27 | this.value = value; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return Objects.toString(this.value, ""); 33 | } 34 | 35 | @Nullable 36 | public Object value() { 37 | return this.value; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/ViolationDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import java.util.Arrays; 19 | 20 | /** 21 | * This class is intended to be used for the JSON serialization (such as Jackson) 22 | */ 23 | public class ViolationDetail { 24 | 25 | private final Object[] args; 26 | 27 | private final String defaultMessage; 28 | 29 | private final String key; 30 | 31 | public ViolationDetail(String key, Object[] args, String defaultMessage) { 32 | this.key = key; 33 | this.args = args; 34 | this.defaultMessage = defaultMessage; 35 | } 36 | 37 | public Object[] getArgs() { 38 | return args; 39 | } 40 | 41 | public String getDefaultMessage() { 42 | return defaultMessage; 43 | } 44 | 45 | public String getKey() { 46 | return key; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "ViolationDetail{" + "key='" + key + '\'' + ", args=" + Arrays.toString(args) + ", defaultMessage='" 52 | + defaultMessage + '\'' + '}'; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/core/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.core; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/factory/ValidatorFactorySupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.factory; 17 | 18 | import am.ik.yavi.builder.ValidatorBuilder; 19 | import am.ik.yavi.jsr305.Nullable; 20 | import am.ik.yavi.message.MessageFormatter; 21 | 22 | abstract class ValidatorFactorySupport { 23 | 24 | protected final String messageKeySeparator; 25 | 26 | protected final MessageFormatter messageFormatter; 27 | 28 | protected ValidatorFactorySupport(@Nullable String messageKeySeparator, 29 | @Nullable MessageFormatter messageFormatter) { 30 | this.messageKeySeparator = messageKeySeparator; 31 | this.messageFormatter = messageFormatter; 32 | } 33 | 34 | protected ValidatorBuilder initBuilder() { 35 | final ValidatorBuilder builder = this.messageKeySeparator == null ? new ValidatorBuilder<>() 36 | : new ValidatorBuilder<>(this.messageKeySeparator); 37 | if (this.messageFormatter != null) { 38 | builder.messageFormatter(messageFormatter); 39 | } 40 | return builder; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/factory/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.factory; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Combining1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | /** 19 | * Generated by 20 | * https://github.com/making/yavi/blob/develop/scripts/generate-applicative.sh 21 | * 22 | * @since 0.6.0 23 | */ 24 | public class Combining1 { 25 | 26 | protected final Validation v1; 27 | 28 | public Combining1(Validation v1) { 29 | this.v1 = v1; 30 | } 31 | 32 | public > V apply(Function1 f) { 33 | return v1.apply(Validation.success(Functions.curry(f))); 34 | } 35 | 36 | public Combining2 combine(Validation v2) { 37 | return new Combining2<>(v1, v2); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Combining2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | /** 19 | * Generated by 20 | * https://github.com/making/yavi/blob/develop/scripts/generate-applicative.sh 21 | * 22 | * @since 0.6.0 23 | */ 24 | public class Combining2 { 25 | 26 | protected final Validation v1; 27 | 28 | protected final Validation v2; 29 | 30 | public Combining2(Validation v1, Validation v2) { 31 | this.v1 = v1; 32 | this.v2 = v2; 33 | } 34 | 35 | public > V apply(Function2 f) { 36 | final Validation> apply1 = v1.apply(Validation.success(Functions.curry(f))); 37 | return v2.apply(apply1); 38 | } 39 | 40 | public Combining3 combine(Validation v3) { 41 | return new Combining3<>(v1, v2, v3); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function1 { 27 | 28 | R apply(@Nullable T1 t1); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function10.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function10 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9, @Nullable T10 t10); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function11.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function11 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9, @Nullable T10 t10, @Nullable T11 t11); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function12.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function12 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9, @Nullable T10 t10, @Nullable T11 t11, @Nullable T12 t12); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function13.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function13 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9, @Nullable T10 t10, @Nullable T11 t11, @Nullable T12 t12, 30 | @Nullable T13 t13); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function14.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function14 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9, @Nullable T10 t10, @Nullable T11 t11, @Nullable T12 t12, 30 | @Nullable T13 t13, @Nullable T14 t14); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function15.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function15 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9, @Nullable T10 t10, @Nullable T11 t11, @Nullable T12 t12, 30 | @Nullable T13 t13, @Nullable T14 t14, @Nullable T15 t15); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function16.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function16 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9, @Nullable T10 t10, @Nullable T11 t11, @Nullable T12 t12, 30 | @Nullable T13 t13, @Nullable T14 t14, @Nullable T15 t15, @Nullable T16 t16); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function2 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function3 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function4 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function5.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function5 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function6.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function6 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function7.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function7 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function8.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function8 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Function9.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import am.ik.yavi.jsr305.Nullable; 19 | 20 | /** 21 | * Generated by https://github.com/making/yavi/blob/develop/scripts/generate-function.sh 22 | * 23 | * @since 0.6.0 24 | */ 25 | @FunctionalInterface 26 | public interface Function9 { 27 | 28 | R apply(@Nullable T1 t1, @Nullable T2 t2, @Nullable T3 t3, @Nullable T4 t4, @Nullable T5 t5, @Nullable T6 t6, 29 | @Nullable T7 t7, @Nullable T8 t8, @Nullable T9 t9); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import java.util.Objects; 19 | 20 | public final class Pair { 21 | 22 | private final F first; 23 | 24 | private final S second; 25 | 26 | public Pair(F first, S second) { 27 | this.first = first; 28 | this.second = second; 29 | } 30 | 31 | @Override 32 | public boolean equals(Object o) { 33 | if (this == o) 34 | return true; 35 | if (o == null || getClass() != o.getClass()) 36 | return false; 37 | Pair pair = (Pair) o; 38 | return Objects.equals(first, pair.first) && Objects.equals(second, pair.second); 39 | } 40 | 41 | public F first() { 42 | return this.first; 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return Objects.hash(first, second); 48 | } 49 | 50 | public S second() { 51 | return this.second; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "Pair{" + "first=" + first + ", second=" + second + '}'; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/fn/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.fn; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/message/MessageFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.message; 17 | 18 | import java.util.Locale; 19 | 20 | @FunctionalInterface 21 | public interface MessageFormatter { 22 | 23 | String format(String messageKey, String defaultMessageFormat, Object[] args, Locale locale); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/message/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.message; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/BigDecimalConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.math.BigDecimal; 19 | 20 | /** 21 | * @since 0.4.0 22 | */ 23 | public interface BigDecimalConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/BigIntegerConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.math.BigInteger; 19 | 20 | /** 21 | * @since 0.4.0 22 | */ 23 | public interface BigIntegerConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/BooleanConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface BooleanConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/ByteConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface ByteConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/CharacterConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface CharacterConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/ConstraintArguments.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * @since 0.4.0 25 | */ 26 | @Target({ ElementType.CONSTRUCTOR, ElementType.METHOD }) 27 | @Retention(RetentionPolicy.SOURCE) 28 | public @interface ConstraintArguments { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/ConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.util.function.Function; 19 | 20 | /** 21 | * @since 0.4.0 22 | */ 23 | public interface ConstraintMeta { 24 | 25 | String name(); 26 | 27 | Function toValue(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/ConstraintTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * @since 0.4.0 25 | */ 26 | @Target({ ElementType.METHOD, ElementType.PARAMETER }) 27 | @Retention(RetentionPolicy.SOURCE) 28 | public @interface ConstraintTarget { 29 | 30 | boolean getter() default true; 31 | 32 | boolean field() default false; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/DoubleConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface DoubleConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/FloatConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface FloatConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/InstantConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.Instant; 19 | 20 | /** 21 | * @since 0.10.0 22 | */ 23 | public interface InstantConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/IntegerConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface IntegerConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/LocalDateConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.LocalDate; 19 | 20 | /** 21 | * @since 0.10.0 22 | */ 23 | public interface LocalDateConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/LocalDateTimeConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.LocalDateTime; 19 | 20 | /** 21 | * @since 0.10.0 22 | */ 23 | public interface LocalDateTimeConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/LocalTimeConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.LocalTime; 19 | 20 | /** 21 | * @since 0.10.0 22 | */ 23 | public interface LocalTimeConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/LongConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface LongConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/ObjectConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface ObjectConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/OffsetDateTimeConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.OffsetDateTime; 19 | 20 | /** 21 | * @since 0.10.0 22 | */ 23 | public interface OffsetDateTimeConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/ShortConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface ShortConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/StringConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | /** 19 | * @since 0.4.0 20 | */ 21 | public interface StringConstraintMeta extends ConstraintMeta { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/YearConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.Year; 19 | 20 | /** 21 | * @since 0.11.0 22 | */ 23 | public interface YearConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/YearMonthConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.YearMonth; 19 | 20 | /** 21 | * @since 0.11.0 22 | */ 23 | public interface YearMonthConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/ZonedDateTimeConstraintMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | import java.time.ZonedDateTime; 19 | 20 | /** 21 | * @since 0.10.0 22 | */ 23 | public interface ZonedDateTimeConstraintMeta extends ConstraintMeta { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/meta/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.meta; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/processor/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.processor; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; 20 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/validator/Yavi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.validator; 17 | 18 | import am.ik.yavi.builder.YaviArguments; 19 | 20 | /** 21 | * YAVI Validator Builder 22 | * 23 | * @since 0.14.0 24 | */ 25 | public final class Yavi { 26 | 27 | /** 28 | * Buider for ArgumentsBuilder
29 | *
30 | * Example: 31 | * 32 | *
33 | 	 * 
34 | 	 * Arguments3Validator<String, String, Integer, Car> validator = Yavi.arguments()
35 | 	 * 	._string("manufacturer", c -> c.notNull())
36 | 	 * 	._string("licensePlate", c -> c.notNull().greaterThanOrEqual(2).lessThanOrEqual(14))
37 | 	 * 	._integer("seatCount", c -> c.greaterThanOrEqual(2))
38 | 	 * 	.apply(Car::new);
39 | 	 *  
40 | * @return {@code YaviArguments} builder 41 | */ 42 | public static YaviArguments arguments() { 43 | return new YaviArguments(); 44 | } 45 | 46 | private Yavi() { 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/am/ik/yavi/validator/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @NonNullApi 17 | package am.ik.yavi.validator; 18 | 19 | import am.ik.yavi.jsr305.NonNullApi; -------------------------------------------------------------------------------- /src/main/resources/META-INF/native-image/am.ik.yavi/yavi/reflect-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "am.ik.yavi.core.ViolationDetail", 4 | "allDeclaredConstructors": true, 5 | "allDeclaredMethods": true 6 | } 7 | ] -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | am.ik.yavi.processor.ConstraintMetaProcessor -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/Address.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | public class Address { 19 | 20 | private final Country country; 21 | 22 | private final PhoneNumber phoneNumber; 23 | 24 | private final String street; 25 | 26 | public Address(Country country, String street, PhoneNumber phoneNumber) { 27 | this.country = country; 28 | this.street = street; 29 | this.phoneNumber = phoneNumber; 30 | } 31 | 32 | public Country country() { 33 | return this.country; 34 | } 35 | 36 | public PhoneNumber phoneNumber() { 37 | return this.phoneNumber; 38 | } 39 | 40 | public String street() { 41 | return this.street; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "Address{" + "country=" + country + ", phoneNumber=" + phoneNumber + ", street='" + street + '\'' + '}'; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/Book.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | public class Book { 19 | 20 | private final String isbn; 21 | 22 | public Book(String isbn) { 23 | this.isbn = isbn; 24 | } 25 | 26 | public String isbn() { 27 | return this.isbn; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/CalendarEntryLocalDate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | import java.time.LocalDate; 19 | 20 | public class CalendarEntryLocalDate { 21 | 22 | private String title; 23 | 24 | private LocalDate date; 25 | 26 | public CalendarEntryLocalDate(String title, LocalDate timepoint) { 27 | this.title = title; 28 | this.date = timepoint; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | public LocalDate getDate() { 40 | return date; 41 | } 42 | 43 | public void setDate(LocalDate date) { 44 | this.date = date; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/CalendarEntryLocalDateTime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | import java.time.LocalDateTime; 19 | 20 | public class CalendarEntryLocalDateTime { 21 | 22 | private String title; 23 | 24 | private LocalDateTime dateTime; 25 | 26 | public CalendarEntryLocalDateTime(String title, LocalDateTime timepoint) { 27 | this.title = title; 28 | this.dateTime = timepoint; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | public LocalDateTime getDateTime() { 40 | return dateTime; 41 | } 42 | 43 | public void setDateTime(LocalDateTime dateTime) { 44 | this.dateTime = dateTime; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/CalendarEntryLocalTime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | import java.time.LocalTime; 19 | 20 | public class CalendarEntryLocalTime { 21 | 22 | private String title; 23 | 24 | private LocalTime time; 25 | 26 | public CalendarEntryLocalTime(String title, LocalTime timepoint) { 27 | this.title = title; 28 | this.time = timepoint; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | public LocalTime getTime() { 40 | return time; 41 | } 42 | 43 | public void setTime(LocalTime time) { 44 | this.time = time; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/Color.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | public enum Color { 19 | 20 | RED, BLUE, GREEN 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/ConstraintViolationsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | import am.ik.yavi.core.ConstraintViolations; 19 | 20 | public class ConstraintViolationsException extends RuntimeException { 21 | 22 | private final ConstraintViolations violations; 23 | 24 | public ConstraintViolationsException(ConstraintViolations violations) { 25 | this.violations = violations; 26 | } 27 | 28 | public ConstraintViolations getViolations() { 29 | return this.violations; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/FormWithArray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | public class FormWithArray { 19 | 20 | private final Address[] addresses; 21 | 22 | public FormWithArray(Address[] addresses) { 23 | this.addresses = addresses; 24 | } 25 | 26 | public Address[] getAddresses() { 27 | return addresses; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/FormWithCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | import java.util.List; 19 | 20 | public class FormWithCollection { 21 | 22 | private final List
addresses; 23 | 24 | public FormWithCollection(List
addresses) { 25 | this.addresses = addresses; 26 | } 27 | 28 | public List
getAddresses() { 29 | return addresses; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/FormWithMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | import java.util.Map; 19 | 20 | public class FormWithMap { 21 | 22 | private final Map addresses; 23 | 24 | public FormWithMap(Map addresses) { 25 | this.addresses = addresses; 26 | } 27 | 28 | public Map getAddresses() { 29 | return addresses; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/Message.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | public class Message { 19 | 20 | private final String text; 21 | 22 | private final Color color; 23 | 24 | public Message(String text, Color color) { 25 | this.text = text; 26 | this.color = color; 27 | } 28 | 29 | public String getText() { 30 | return text; 31 | } 32 | 33 | public Color getColor() { 34 | return color; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/NestedFormWithCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | import java.util.List; 19 | 20 | public class NestedFormWithCollection { 21 | 22 | private final List forms; 23 | 24 | public NestedFormWithCollection(List forms) { 25 | this.forms = forms; 26 | } 27 | 28 | public List getForms() { 29 | return forms; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/Range.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | public class Range { 19 | 20 | private final int from; 21 | 22 | private final int to; 23 | 24 | public Range(int from, int to) { 25 | this.from = from; 26 | this.to = to; 27 | } 28 | 29 | public int getFrom() { 30 | return from; 31 | } 32 | 33 | public int getTo() { 34 | return to; 35 | } 36 | 37 | public boolean isToGreaterThanFrom() { 38 | return this.to > this.from; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi; 17 | 18 | public class User { 19 | 20 | private Integer age; 21 | 22 | private String email; 23 | 24 | private boolean enabled = true; 25 | 26 | private String name; 27 | 28 | public User(String name, String email, Integer age) { 29 | this.name = name; 30 | this.email = email; 31 | this.age = age; 32 | } 33 | 34 | public Integer getAge() { 35 | return age; 36 | } 37 | 38 | public void setAge(Integer age) { 39 | this.age = age; 40 | } 41 | 42 | public String getEmail() { 43 | return email; 44 | } 45 | 46 | public void setEmail(String email) { 47 | this.email = email; 48 | } 49 | 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | public void setName(String name) { 55 | this.name = name; 56 | } 57 | 58 | public boolean isEnabled() { 59 | return enabled; 60 | } 61 | 62 | public void setEnabled(boolean enabled) { 63 | this.enabled = enabled; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/arguments/Product.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | import am.ik.yavi.builder.ArgumentsValidatorBuilder; 19 | import am.ik.yavi.core.ConstraintViolationsException; 20 | 21 | public class Product { 22 | 23 | private final String name; 24 | 25 | private final int price; 26 | 27 | static final Arguments2Validator validator = ArgumentsValidatorBuilder.of(Product::new) // 28 | .builder(b -> b // 29 | ._string(Arguments2::arg1, "name", c -> c.notEmpty()) 30 | ._integer(Arguments2::arg2, "price", c -> c.greaterThan(0))) 31 | .build(); 32 | 33 | public Product(String name, int price) { 34 | validator.lazy().validate(name, price).throwIfInvalid(ConstraintViolationsException::new); 35 | this.name = name; 36 | this.price = price; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "Product{" + "name='" + name + '\'' + ", price=" + price + '}'; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/arguments/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | public class User { 19 | 20 | private final String email; 21 | 22 | private final String name; 23 | 24 | private final Role role; 25 | 26 | public enum Role { 27 | 28 | USER, ADMIN, GUEST 29 | 30 | } 31 | 32 | public User(String email, String name, Role role) { 33 | this.email = email; 34 | this.name = name; 35 | this.role = role; 36 | } 37 | 38 | public String email() { 39 | return email; 40 | } 41 | 42 | public String name() { 43 | return name; 44 | } 45 | 46 | public Role role() { 47 | return role; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "User{" + "email='" + email + '\'' + ", name='" + name + '\'' + ", role=" + role + '}'; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/arguments/UserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.arguments; 17 | 18 | public class UserService { 19 | 20 | public User createUser(String email, String name, User.Role role) { 21 | return new User(email, name, role); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/constraint/BooleanConstraintTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint; 17 | 18 | import org.junit.jupiter.api.Test; 19 | 20 | import java.util.function.Predicate; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | class BooleanConstraintTest { 25 | 26 | private BooleanConstraint constraint = new BooleanConstraint<>(); 27 | 28 | @Test 29 | void isFalse() { 30 | Predicate predicate = constraint.isFalse().predicates().peekFirst().predicate(); 31 | assertThat(predicate.test(true)).isFalse(); 32 | assertThat(predicate.test(false)).isTrue(); 33 | } 34 | 35 | @Test 36 | void isTrue() { 37 | Predicate predicate = constraint.isTrue().predicates().peekFirst().predicate(); 38 | assertThat(predicate.test(true)).isTrue(); 39 | assertThat(predicate.test(false)).isFalse(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/constraint/charsequence/RangeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.constraint.charsequence; 17 | 18 | import org.assertj.core.api.Assertions; 19 | import org.junit.jupiter.api.Test; 20 | 21 | import am.ik.yavi.constraint.charsequence.CodePoints.Range; 22 | 23 | class RangeTest { 24 | 25 | @Test 26 | void ofString() { 27 | Range range = Range.of("a", "z"); 28 | Assertions.assertThat(range).isEqualTo(Range.of(0x0061 /* a */, 0x007a /* z */)); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/core/Group.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | public enum Group implements ConstraintGroup { 19 | 20 | CREATE, UPDATE, DELETE 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/core/InlineNestedValidatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.core; 17 | 18 | import am.ik.yavi.Address; 19 | import am.ik.yavi.Country; 20 | import am.ik.yavi.PhoneNumber; 21 | import am.ik.yavi.builder.ValidatorBuilder; 22 | 23 | public class InlineNestedValidatorTest extends AbstractNestedValidatorTest { 24 | 25 | @Override 26 | protected Validator
validator() { 27 | return ValidatorBuilder.
of() 28 | .constraint(Address::street, "street", c -> c.notBlank().lessThan(32)) 29 | .nest(Address::country, "country", b -> b.constraint(Country::name, "name", c -> c.notBlank() // 30 | .greaterThanOrEqual(2))) 31 | .nestIfPresent(Address::phoneNumber, "phoneNumber", 32 | b -> b.constraint(PhoneNumber::value, "value", c -> c.notBlank() // 33 | .greaterThanOrEqual(8))) 34 | .build(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/fn/FunctionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.fn; 17 | 18 | import org.junit.jupiter.api.Test; 19 | 20 | import static org.assertj.core.api.Assertions.assertThat; 21 | 22 | class FunctionsTest { 23 | 24 | @Test 25 | void curry() { 26 | final Function2 add = (x, y) -> x + y; 27 | final Function1 add10 = Functions.curry(add).apply(10); 28 | final Integer result = add10.apply(2); 29 | assertThat(result).isEqualTo(12); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/message/MessageSourceMessageFormatterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.message; 17 | 18 | import java.util.Arrays; 19 | import java.util.Locale; 20 | 21 | import am.ik.yavi.message.MessageSourceMessageFormatter.MessageSource; 22 | import org.junit.jupiter.api.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | class MessageSourceMessageFormatterTest { 27 | 28 | @Test 29 | void format() { 30 | final MessageSource messageSource = (code, args, defaultMessage, locale) -> "Message " + code + " " 31 | + Arrays.toString(args); 32 | final MessageSourceMessageFormatter messageFormatter = new MessageSourceMessageFormatter(messageSource); 33 | final String message = messageFormatter.format("demo", "", new Object[] { 1, 2 }, Locale.ENGLISH); 34 | assertThat(message).isEqualTo("Message demo [1, 2]"); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/meta/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | public class Person { 19 | 20 | private final String firstName; 21 | 22 | private final String lastName; 23 | 24 | private final int age; 25 | 26 | @ConstraintArguments 27 | public Person(String firstName, String lastName, int age) { 28 | this.firstName = firstName; 29 | this.lastName = lastName; 30 | this.age = age; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/meta/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | public class User { 19 | 20 | private final String email; 21 | 22 | private final String name; 23 | 24 | public User(String email, String name) { 25 | this.email = email; 26 | this.name = name; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "User{" + "email='" + email + '\'' + ", name='" + name + '\'' + '}'; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/meta/UserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | public class UserService { 19 | 20 | @ConstraintArguments 21 | public User createUser(String email, String name) { 22 | return new User(email, name); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/meta/_Address_CountryMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | public class _Address_CountryMeta { 19 | 20 | public static final StringConstraintMeta NAME = new StringConstraintMeta() { 21 | 22 | @Override 23 | public String name() { 24 | return "name"; 25 | } 26 | 27 | @Override 28 | public java.util.function.Function toValue() { 29 | return am.ik.yavi.meta.Address.Country::name; 30 | } 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/am/ik/yavi/meta/_Address_PhoneNumberMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package am.ik.yavi.meta; 17 | 18 | public class _Address_PhoneNumberMeta { 19 | 20 | public static final StringConstraintMeta VALUE = new StringConstraintMeta() { 21 | 22 | @Override 23 | public String name() { 24 | return "value"; 25 | } 26 | 27 | @Override 28 | public java.util.function.Function toValue() { 29 | return am.ik.yavi.meta.Address.PhoneNumber::value; 30 | } 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/test/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | import am.ik.yavi.meta.ConstraintTarget; 19 | 20 | public class Car { 21 | private final String name; 22 | private final int gas; 23 | 24 | public Car(String name, int gas) { 25 | this.name = name; 26 | this.gas = gas; 27 | } 28 | 29 | @ConstraintTarget(getter = false) 30 | public String name() { 31 | return this.name; 32 | } 33 | 34 | @ConstraintTarget(getter = false) 35 | public int gas() { 36 | return this.gas; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/test/Car2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | import am.ik.yavi.meta.ConstraintArguments; 19 | 20 | public class Car2 { 21 | private final String name; 22 | private final int gas; 23 | 24 | @ConstraintArguments 25 | public Car2(String name, int gas) { 26 | this.name = name; 27 | this.gas = gas; 28 | } 29 | 30 | public String name() { 31 | return this.name; 32 | } 33 | 34 | public int gas() { 35 | return this.gas; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/resources/test/CarBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | import am.ik.yavi.meta.ConstraintTarget; 19 | 20 | public class CarBean { 21 | private String name; 22 | private int gas; 23 | 24 | public CarBean(String name, int gas) { 25 | this.name = name; 26 | this.gas = gas; 27 | } 28 | 29 | @ConstraintTarget 30 | public String getName() { 31 | return this.name; 32 | } 33 | 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | 38 | @ConstraintTarget 39 | public int getGas() { 40 | return this.gas; 41 | } 42 | 43 | public void setGas(int gas) { 44 | this.gas = gas; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/resources/test/CarField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | import am.ik.yavi.meta.ConstraintTarget; 19 | 20 | public class CarField { 21 | final String name; 22 | final int gas; 23 | 24 | public CarField(@ConstraintTarget(field = true) String name, @ConstraintTarget(field = true) int gas) { 25 | this.name = name; 26 | this.gas = gas; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/test/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | public class User { 19 | private final String email; 20 | private final String name; 21 | 22 | public User(String email, String name) { 23 | this.email = email; 24 | this.name = name; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "User{" + "email='" + email + '\'' + ", name='" + name + '\'' + '}'; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/resources/test/UserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | import am.ik.yavi.meta.ConstraintArguments; 19 | 20 | public class UserService { 21 | @ConstraintArguments 22 | public User createUser(String email, String name) { 23 | return new User(email, name); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/test/_Address_CountryMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | public class _Address_CountryMeta { 19 | 20 | public static final am.ik.yavi.meta.StringConstraintMeta NAME = new am.ik.yavi.meta.StringConstraintMeta() { 21 | 22 | @Override 23 | public String name() { 24 | return "name"; 25 | } 26 | 27 | @Override 28 | public java.util.function.Function toValue() { 29 | return test.Address.Country::name; 30 | } 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/test/_Address_PhoneNumberMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | public class _Address_PhoneNumberMeta { 19 | 20 | public static final am.ik.yavi.meta.StringConstraintMeta VALUE = new am.ik.yavi.meta.StringConstraintMeta() { 21 | 22 | @Override 23 | public String name() { 24 | return "value"; 25 | } 26 | 27 | @Override 28 | public java.util.function.Function toValue() { 29 | return test.Address.PhoneNumber::value; 30 | } 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/test/_CarBeanMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | public class _CarBeanMeta { 19 | public static final am.ik.yavi.meta.StringConstraintMeta NAME = new am.ik.yavi.meta.StringConstraintMeta() { 20 | 21 | @Override 22 | public String name() { 23 | return "name"; 24 | } 25 | 26 | @Override 27 | public java.util.function.Function toValue() { 28 | return test.CarBean::getName; 29 | } 30 | }; 31 | 32 | public static final am.ik.yavi.meta.IntegerConstraintMeta GAS = new am.ik.yavi.meta.IntegerConstraintMeta() { 33 | 34 | @Override 35 | public String name() { 36 | return "gas"; 37 | } 38 | 39 | @Override 40 | public java.util.function.Function toValue() { 41 | return test.CarBean::getGas; 42 | } 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/test/_CarFieldMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | public class _CarFieldMeta { 19 | public static final am.ik.yavi.meta.StringConstraintMeta NAME = new am.ik.yavi.meta.StringConstraintMeta() { 20 | 21 | @Override 22 | public String name() { 23 | return "name"; 24 | } 25 | 26 | @Override 27 | public java.util.function.Function toValue() { 28 | return x -> x.name; 29 | } 30 | }; 31 | 32 | public static final am.ik.yavi.meta.IntegerConstraintMeta GAS = new am.ik.yavi.meta.IntegerConstraintMeta() { 33 | 34 | @Override 35 | public String name() { 36 | return "gas"; 37 | } 38 | 39 | @Override 40 | public java.util.function.Function toValue() { 41 | return x -> x.gas; 42 | } 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/test/_CarMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2025 Toshiaki Maki 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package test; 17 | 18 | public class _CarMeta { 19 | public static final am.ik.yavi.meta.StringConstraintMeta NAME = new am.ik.yavi.meta.StringConstraintMeta() { 20 | 21 | @Override 22 | public String name() { 23 | return "name"; 24 | } 25 | 26 | @Override 27 | public java.util.function.Function toValue() { 28 | return test.Car::name; 29 | } 30 | }; 31 | 32 | public static final am.ik.yavi.meta.IntegerConstraintMeta GAS = new am.ik.yavi.meta.IntegerConstraintMeta() { 33 | 34 | @Override 35 | public String name() { 36 | return "gas"; 37 | } 38 | 39 | @Override 40 | public java.util.function.Function toValue() { 41 | return test.Car::gas; 42 | } 43 | }; 44 | } 45 | --------------------------------------------------------------------------------