diff --git a/documentation/pom.xml b/documentation/pom.xml index 305f57424e..c96cc5f515 100644 --- a/documentation/pom.xml +++ b/documentation/pom.xml @@ -28,7 +28,7 @@ ${basedir}/../engine/src/main/java validator - ${html.meta.project-key} + ${html.meta.project-key} -Duser.language=en -Duser.country=US @@ -227,7 +227,7 @@ css false font-awesome/css/font-awesome.min - prettify + rouge @@ -240,10 +240,13 @@ org.hibernate.infra.asciidoctor.extensions.copytoclipboard.CopyToClipboardProcessor + + org.hibernate.infra.asciidoctor.extensions.sourcecodelanguage.SourcecodeLanguagePreprocessor + - index.asciidoc + index.adoc - ${asciidoctor.aggregated-resources-dir}/docinfo/noorm-documentation + ${asciidoctor.aggregated-resources-dir}/docinfo/hibernate font 4 @@ -252,6 +255,7 @@ ${asciidoctor.engine-source-dir} ${project.version} + ${parsed-version.org.hibernate.validator.majorVersion}.${parsed-version.org.hibernate.validator.minorVersion} ${version.jakarta.validation-api} ${version.org.jboss.logging.jboss-logging} ${version.com.fasterxml.classmate} @@ -321,6 +325,7 @@ pdf ${asciidoctor.base-output-dir}/pdf + ${asciidoctor.aggregated-resources-dir}/theme/hibernate.rb ${asciidoctor.aggregated-resources-dir}/images/ ${asciidoctor.aggregated-resources-dir}/theme @@ -329,7 +334,8 @@ - - coderay + rouge + hibernate diff --git a/documentation/src/main/asciidoc/ch01.asciidoc b/documentation/src/main/asciidoc/_ch01.adoc similarity index 98% rename from documentation/src/main/asciidoc/ch01.asciidoc rename to documentation/src/main/asciidoc/_ch01.adoc index 98526fb08c..3ef4ac0c03 100644 --- a/documentation/src/main/asciidoc/ch01.asciidoc +++ b/documentation/src/main/asciidoc/_ch01.adoc @@ -15,7 +15,7 @@ your __pom.xml__: .Hibernate Validator Maven dependency ==== -[source, XML] +[source, xml] [subs="verbatim,attributes"] ---- @@ -42,7 +42,7 @@ implementation]: .Maven dependencies for Unified EL reference implementation ==== -[source, XML] +[source, xml] [subs="verbatim,attributes"] ---- @@ -71,7 +71,7 @@ Validator CDI portable extension by adding the following Maven dependency to you .Hibernate Validator CDI portable extension Maven dependency ==== -[source, XML] +[source, xml] [subs="verbatim,attributes"] ---- @@ -115,7 +115,7 @@ Let's dive directly into an example to see how to apply constraints. [[example-class-car]] .Class Car annotated with constraints ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter01/Car.java[] ---- @@ -144,7 +144,7 @@ unit test for `Car`: .Class CarTest showing validation examples ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter01/CarTest.java[] ---- diff --git a/documentation/src/main/asciidoc/ch02.asciidoc b/documentation/src/main/asciidoc/_ch02.adoc similarity index 98% rename from documentation/src/main/asciidoc/ch02.asciidoc rename to documentation/src/main/asciidoc/_ch02.adoc index 24f0987056..1b2c3fe6df 100644 --- a/documentation/src/main/asciidoc/ch02.asciidoc +++ b/documentation/src/main/asciidoc/_ch02.adoc @@ -36,7 +36,7 @@ level configuration example: [[example-field-level]] .Field-level constraints ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/fieldlevel/Car.java[tags=include] ---- @@ -66,7 +66,7 @@ constraints are used. [[example-property-level]] .Property-level constraints ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/propertylevel/Car.java[tags=include] ---- @@ -129,12 +129,12 @@ element. <> shows an example of [[example-container-element-constraints-iterable]] .Container element constraint on `Set` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/set/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/set/CarTest.java[tags=validateSetContainerElementConstraint] ---- @@ -151,12 +151,12 @@ element. <> shows an example of a [[example-container-element-constraints-list]] .Container element constraint on `List` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/list/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/list/CarTest.java[tags=validateListContainerElementConstraint] ---- @@ -173,17 +173,17 @@ and a constraint on the value. [[example-container-element-constraints-map]] .Container element constraint on map keys and values ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/map/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/map/CarTest.java[tags=validateMapValueContainerElementConstraint] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/map/CarTest.java[tags=validateMapKeyContainerElementConstraint] ---- @@ -204,12 +204,12 @@ an example of an `Optional` with a container element constraint. [[example-container-element-constraints-optional]] .Container element constraint on Optional ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/optional/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/optional/CarTest.java[tags=validateOptionalContainerElementConstraint] ---- @@ -232,27 +232,27 @@ parameterized type with a type argument constraint. [[example-container-element-constraints-custom-container-type]] .Container element constraint on custom container type ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/custom/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/custom/GearBox.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/custom/Gear.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/custom/GearBoxValueExtractor.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/custom/CarTest.java[tags=validateCustomContainerElementConstraint] ---- @@ -268,7 +268,7 @@ constraints on `Part` and `Manufacturer` will be enforced. [[example-container-element-nested]] .Constraints on nested container elements ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/containerelement/nested/Car.java[tags=include] ---- @@ -293,7 +293,7 @@ constraint. [[example-class-level]] .Class-level constraint ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/classlevel/Car.java[tags=include] ---- @@ -308,12 +308,12 @@ things clearer let's have a look at the following example: .Constraint inheritance ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/inheritance/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter02/inheritance/RentalCar.java[tags=include] ---- @@ -339,12 +339,12 @@ reference to another object with `@Valid` as demonstrated in <>. [[example-declaring-parameter-constraints]] .Declaring method and constructor parameter constraints ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/parameter/RentalStation.java[tags=include] ---- @@ -91,7 +91,7 @@ ensure that no passenger has more than two pieces of luggage. [[example-using-cross-parameter-constraint]] .Declaring a cross-parameter constraint ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/crossparameter/Car.java[tags=include] ---- @@ -116,7 +116,7 @@ to apply the constraint to the executable return value. [[example-specifying-constraint-target]] .Specifying a constraint's target ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/crossparameter/constrainttarget/Garage.java[tags=include] ---- @@ -142,7 +142,7 @@ executable as shown in <>. [[example-declaring-return-value-constraints]] .Declaring method and constructor return value constraints ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/returnvalue/RentalStation.java[tags=include] ---- @@ -174,12 +174,12 @@ well as the return value of the `Garage` constructor are marked for cascaded val [[example-cascaded-executable-validation]] .Marking executable parameters and return values for cascaded validation ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/cascaded/Garage.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/cascaded/Car.java[tags=include] ---- @@ -208,7 +208,7 @@ will be validated and a `ConstraintViolation` created when any of the contained [[example-cascaded-executable-validation-container-elements]] .Container elements of method parameter marked for cascaded validation ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/cascaded/containerelement/Garage.java[tags=include] ---- @@ -239,12 +239,12 @@ methods which override or implement a method declared in a supertype (superclass [[example-illegal-parameter-constraints]] .Illegal method parameter constraint in subtype ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/inheritance/parameter/Vehicle.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/inheritance/parameter/Car.java[tags=include] ---- @@ -264,17 +264,17 @@ Therefore the constraint on `Vehicle#drive()` is illegal. [[example-illegal-parameter-constraints-parallel-types]] .Illegal method parameter constraint in parallel types of a hierarchy ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/inheritance/parallel/Vehicle.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/inheritance/parallel/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/inheritance/parallel/RacingCar.java[tags=include] ---- @@ -296,12 +296,12 @@ as the `@NotNull` constraint on the implemented interface method `Vehicle#getPas [[example-return-value-constraints-in-hierarchy]] .Return value constraints on supertype and subtype method ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/inheritance/returnvalue/Vehicle.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/inheritance/returnvalue/Car.java[tags=include] ---- @@ -349,7 +349,7 @@ You can retrieve an `ExecutableValidator` instance via `Validator#forExecutables [[example-obtaining-executable-validator]] .Obtaining an `ExecutableValidator` instance ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/validation/CarTest.java[tags=setUpValidator] ---- @@ -379,7 +379,7 @@ shown in <>. [[example-executable-validator-class-car]] .Class `Car` with constrained methods and constructors ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/validation/Car.java[tags=include] ---- @@ -394,7 +394,7 @@ violation of the `@Max` constraint on the parameter of the `drive()` method. [[example-executable-validator-validate-parameters]] .Using `ExecutableValidator#validateParameters()` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/validation/CarTest.java[tags=validateParameters] ---- @@ -412,7 +412,7 @@ Using `validateReturnValue()` the return value of a method can be validated. The [[example-executable-validator-validate-return-value]] .Using `ExecutableValidator#validateReturnValue()` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/validation/CarTest.java[tags=validateReturnValue] ---- @@ -428,7 +428,7 @@ violation. [[example-executable-validator-validate-constructor-parameters]] .Using `ExecutableValidator#validateConstructorParameters()` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/validation/CarTest.java[tags=validateConstructorParameters] ---- @@ -444,7 +444,7 @@ the `@ValidRacingCar` constraint (not shown). [[example-executable-validator-validate-constructor-return-value]] .Using `ExecutableValidator#validateConstructorReturnValue()` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/validation/CarTest.java[tags=validateConstructorReturnValue] ---- @@ -474,7 +474,7 @@ path nodes. How this can be done is shown in <> could be expressed [[example-parameterscriptassert]] .Using `@ParameterScriptAssert` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter03/parameterscriptassert/Car.java[tags=include] ---- diff --git a/documentation/src/main/asciidoc/ch04.asciidoc b/documentation/src/main/asciidoc/_ch04.adoc similarity index 98% rename from documentation/src/main/asciidoc/ch04.asciidoc rename to documentation/src/main/asciidoc/_ch04.adoc index cdd08b4fa7..d7457f2325 100644 --- a/documentation/src/main/asciidoc/ch04.asciidoc +++ b/documentation/src/main/asciidoc/_ch04.adoc @@ -16,7 +16,7 @@ descriptor can be overridden with a specific value as shown in <>. [[example-group-sequence]] .Using a group sequence ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/GroupTest.java[tags=testOrderedChecks] ---- @@ -208,12 +208,12 @@ the sequence of groups which substitute `Default` for this class within the anno [[example-rental-car]] .Class `RentalCar` with redefined default group ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/RentalCar.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/RentalChecks.java[] ---- @@ -225,7 +225,7 @@ With this definition you can evaluate the constraints belonging to `RentalChecks [[example-testCarIsRented]] .Validating an object with redefined default group ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/GroupTest.java[tags=carIsRented] ---- @@ -260,12 +260,12 @@ scenario, you could for instance dynamically add the `CarChecks` as seen in [[example-implementing-using-default-group-sequence-provider]] .Implementing and using a default group sequence provider ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/groupsequenceprovider/RentalCarGroupSequenceProvider.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/groupsequenceprovider/RentalCar.java[tags=include] ---- @@ -288,12 +288,12 @@ cascaded validation of the driver association. [[example-group-conversion-dedault-to-driver-checks]] .`@ConvertGroup` usage ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/groupconversion/Driver.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/groupconversion/Car.java[tags=include] ---- @@ -306,7 +306,7 @@ the `validate()` call. [[example-group-conversion-test]] .Test case for `@ConvertGroup` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter05/groupconversion/GroupConversionTest.java[tags=validateDriverChecksTogetherWithCarChecks] ---- diff --git a/documentation/src/main/asciidoc/ch06.asciidoc b/documentation/src/main/asciidoc/_ch06.adoc similarity index 97% rename from documentation/src/main/asciidoc/ch06.asciidoc rename to documentation/src/main/asciidoc/_ch06.adoc index 1187338caa..bb3c90357d 100644 --- a/documentation/src/main/asciidoc/ch06.asciidoc +++ b/documentation/src/main/asciidoc/_ch06.adoc @@ -27,7 +27,7 @@ a better approach is using an enum for that purpose: .Enum `CaseMode` to express upper vs. lower case ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/CaseMode.java[] ---- @@ -39,7 +39,7 @@ before, this may look a bit scary, but actually it's not that hard: [[example-defining-custom-constraint]] .Defining the `@CheckCase` constraint annotation ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/CheckCase.java[tags=include] ---- @@ -60,12 +60,12 @@ payload objects to a constraint. This attribute is not used by the API itself. A custom payload could be the definition of a severity: + ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/payload/Severity.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/payload/ContactDetails.java[tags=include] ---- @@ -122,7 +122,7 @@ as shown below: [[example-constraint-validator]] .Implementing a constraint validator for the constraint `@CheckCase` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/CheckCaseValidator.java[tags=include] ---- @@ -156,7 +156,7 @@ demonstrated with an example: [[example-constraint-validator-context]] .Using `ConstraintValidatorContext` to define custom error messages ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/constraintvalidatorcontext/CheckCaseValidator.java[tags=include] ---- @@ -206,7 +206,7 @@ The example below shows how to base your validators on `HibernateConstraintValid [[example-constraint-validator-hibernateconstraintvalidator]] .Using the `HibernateConstraintValidator` contract ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/MyFutureValidator.java[tags=include] ---- @@ -237,7 +237,7 @@ constraint validator payload value set. [[example-constraint-validator-payload-definition-validatorfactory]] .Defining a constraint validator payload during the `ValidatorFactory` initialization ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/constraintvalidatorpayload/ConstraintValidatorPayloadTest.java[tags=setConstraintValidatorPayloadDuringValidatorFactoryInitialization] ---- @@ -248,7 +248,7 @@ Another option is to set the constraint validator payload per `Validator` using [[example-constraint-validator-payload-definition-validatorcontext]] .Defining a constraint validator payload using a `Validator` context ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/constraintvalidatorpayload/ConstraintValidatorPayloadTest.java[tags=setConstraintValidatorPayloadInValidatorContext] ---- @@ -259,7 +259,7 @@ Once you have set the constraint validator payload, it can be used in your const [[example-constraint-validator-payload-usage]] .Using the constraint validator payload in a constraint validator ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/constraintvalidatorpayload/ZipCodeValidator.java[tags=include] ---- @@ -295,7 +295,7 @@ provided during the Hibernate Validator factory configuration. [[example-constraint-validator-shared-data-definition-validatorfactory]] .Defining a constraint validator initialization shared data during the `ValidatorFactory` initialization ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/constraintvalidatorshareddata/ConstraintValidatorPayloadTest.java[tags=setSharedData] ---- @@ -306,7 +306,7 @@ Once you have set the constraint validator initialization shared data, it can be [[example-constraint-validator-shared-data-usage]] .Accessing the constraint validator initialization shared data in a constraint validator ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/constraintvalidatorshareddata/ZipCodeValidator.java[tags=include] ---- @@ -322,7 +322,7 @@ and is not defined at the time of configuring the validator factory. [[example-constraint-validator-shared-data-usage-alternative]] .Accessing the constraint validator lazy initialization shared data in a constraint validator ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/constraintvalidatorshareddata/ParsableDateTimeFormatValidator.java[tags=include] ---- @@ -362,7 +362,7 @@ specify that the `licensePlate` field should only contain upper-case strings: [[example-car-with-checkcase]] .Applying the `@CheckCase` constraint ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/Car.java[tags=include] ---- @@ -374,7 +374,7 @@ license plate causes the `@CheckCase` constraint to be violated. [[example-using-checkcase]] .Validating objects with the `@CheckCase` constraint ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/CarTest.java[tags=testCheckCaseConstraint] ---- @@ -391,12 +391,12 @@ entire object. Class-level constraints are defined in the same way as are proper [[example-implementing-classlevel-constraint]] .Implementing a class-level constraint ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/classlevel/ValidPassengerCount.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/classlevel/ValidPassengerCountValidator.java[tags=include] ---- @@ -425,7 +425,7 @@ could add several property nodes, pointing to a sub-entity of the validated bean [[example-custom-error]] .Adding a new `ConstraintViolation` with custom property path ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/custompath/ValidPassengerCountValidator.java[tags=include] ---- @@ -451,7 +451,7 @@ check that two `Date` parameters of a method are in the correct order: .Cross-parameter constraint ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/crossparameter/ConsistentDateParameters.java[tags=include] ---- @@ -476,7 +476,7 @@ constraint target apparent. [[example-cross-parameter-validator]] .Generic and cross-parameter constraint ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/crossparameter/ConsistentDateParametersValidator.java[tags=include] ---- @@ -512,7 +512,7 @@ to specify the constraint's target as shown in <> can be expressed in XML. [[example-rental-station-xml]] .Method constraints configured via XML ==== -[source, XML, indent=0] +[source, xml, indent=0] ---- include::{resourcesdir}/org/hibernate/validator/referenceguide/chapter08/rental-station-mapping.xml[] ---- @@ -167,7 +167,7 @@ However, there is also a purely regular expression based version available which XML: .Using XML to register a regular expression based constraint definition for `@URL` -[source, XML] +[source, xml] ---- diff --git a/documentation/src/main/asciidoc/ch09.asciidoc b/documentation/src/main/asciidoc/_ch09.adoc similarity index 96% rename from documentation/src/main/asciidoc/ch09.asciidoc rename to documentation/src/main/asciidoc/_ch09.adoc index 6d56026996..566bbac2f8 100644 --- a/documentation/src/main/asciidoc/ch09.asciidoc +++ b/documentation/src/main/asciidoc/_ch09.adoc @@ -17,7 +17,7 @@ validator factory: [[example-build-default-validator-factory]] .Bootstrapping default `ValidatorFactory` and `Validator` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=buildDefaultValidatorFactory] ---- @@ -40,7 +40,7 @@ provider's `ValidationProvider` class as shown in <` element in the _META-INF/validation.xml_ file [[example-using-custom-parameter-name-provider]] .Using a custom `ParameterNameProvider` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/MyParameterNameProvider.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=parameterNameProvider] ---- @@ -299,12 +299,12 @@ provide a `java.time.Clock` defining `now` for time related validators. [[example-using-custom-clock-provider]] .Using a custom `ClockProvider` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/FixedClockProvider.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=clockProvider] ---- @@ -333,7 +333,7 @@ You can set a temporal validation tolerance by bootstrapping your `ValidatorFact [[example-using-temporal-validation-tolerance]] .Using temporal validation tolerance ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=temporalValidationTolerance] ---- @@ -367,7 +367,7 @@ to extract the keys and the values of Guava's `Multimap`. [[example-registering-value-extractor]] .Registering additional value extractors ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=valueExtractor] ---- @@ -386,7 +386,7 @@ stream(s) must adhere to the XML schema for constraint mappings presented in [[example-adding-mapping-streams]] .Adding constraint mapping streams ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=addMapping] ---- @@ -407,7 +407,7 @@ more programmatic constraint mappings as demonstrated in [[example-hibernate-validator-specific-options]] .Setting Hibernate Validator specific options ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=providerSpecificOptions] ---- @@ -419,7 +419,7 @@ Validator supports enabling the fail fast mode that way, too: [[example-hibernate-validator-specific-option-via-addproperty]] .Enabling a Hibernate Validator specific option via `addProperty()` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=providerSpecificOptionViaAddProperty] ---- @@ -448,7 +448,7 @@ property. [[example-script-evaluator-factory-xml]] .Defining the `ScriptEvaluatorFactory` via XML ==== -[source, XML, indent=0] +[source, xml, indent=0] ---- include::{resourcesdir}/org/hibernate/validator/referenceguide/chapter09/script-evaluator-factory-validation.xml[] ---- @@ -465,7 +465,7 @@ shows how this can be done. [[example-script-evaluator-factory-programmatically]] .Defining the `ScriptEvaluatorFactory` programmatically ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=scriptEvaluatorFactoryProgrammatically] ---- @@ -484,7 +484,7 @@ Thus the script engine wouldn't be found using the default strategy. To solve this issue, the `MultiClassLoaderScriptEvaluatorFactory` class below can be introduced: ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/MultiClassLoaderScriptEvaluatorFactory.java[] ---- @@ -493,7 +493,7 @@ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/MultiClass and then declared with: ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=scriptEvaluatorFactoryMultiClassLoaderScriptEvaluatorFactory] ---- @@ -507,7 +507,7 @@ For instance, to use the https://docs.spring.io/spring/docs/current/spring-frame you can define a `SpringELScriptEvaluatorFactory` as: ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/SpringELScriptEvaluatorFactory.java[tags=include] ---- @@ -517,7 +517,7 @@ This factory allows to use Spring Expression Language in `ScriptAssert` and `Par constraints: ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/CustomScriptEvaluatorFactoryForSpringELTest.java[tags=include] ---- @@ -533,7 +533,7 @@ can be configured to print these values as well. As usual, there are a few ways .Programmatic configuration ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/LoggingConfigurationTest.java[tags=programmatic] ---- @@ -541,7 +541,7 @@ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/LoggingCon .Programmatic configuration via property ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/LoggingConfigurationTest.java[tags=programmaticProperty] ---- @@ -549,7 +549,7 @@ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/LoggingCon .XML configuration via property ==== -[source, XML, indent=0] +[source, xml, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/validation-ShowValidatedValueInLogs.xml[] ---- @@ -571,7 +571,7 @@ be achieved by calling `ValidatorFactory#usingContext()`. [[example-using-context]] .Configuring a `Validator` instance via `usingContext()` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter09/BootstrappingTest.java[tags=usingContext] ---- diff --git a/documentation/src/main/asciidoc/ch10.asciidoc b/documentation/src/main/asciidoc/_ch10.adoc similarity index 97% rename from documentation/src/main/asciidoc/ch10.asciidoc rename to documentation/src/main/asciidoc/_ch10.adoc index 5ae4f518a7..66ad6bc5b2 100644 --- a/documentation/src/main/asciidoc/ch10.asciidoc +++ b/documentation/src/main/asciidoc/_ch10.adoc @@ -12,27 +12,27 @@ The examples presented in this chapter are based on the classes and constraint d [[metadata-example-car]] .Example classes ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/Person.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/Vehicle.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/Car.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/Library.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/Book.java[tags=include] ---- @@ -58,7 +58,7 @@ If a constraint declaration hosted by the requested class is invalid, a `Validat [[metadata-example-using-beandescriptor]] .Using `BeanDescriptor` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/CarTest.java[tags=testBeanDescriptor] ---- @@ -102,7 +102,7 @@ how to use the `PropertyDescriptor` interface. [[metadata-example-using-propertydescriptor]] .Using `PropertyDescriptor` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/CarTest.java[tags=testPropertyDescriptor] ---- @@ -125,7 +125,7 @@ descriptors. [[metadata-example-using-methodandconstructordescriptor]] .Using `MethodDescriptor` and `ConstructorDescriptor` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/CarTest.java[tags=testMethodAndConstructorDescriptor] ---- @@ -186,7 +186,7 @@ respectively, [[metadata-example-using-elementdescriptor]] .Using `ElementDescriptor methods` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/CarTest.java[tags=testElementDescriptor] ---- @@ -199,7 +199,7 @@ constraint metadata in a fine grained way. <> shows h [[example-constraint-finder]] .Usage of `ConstraintFinder` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/CarTest.java[tags=testConstraintFinderApi] ---- @@ -242,7 +242,7 @@ to retrieve the set of `ContainerElementTypeDescriptor`. [[metadata-example-using-containerelementtypedescriptor]] .Using `ContainerElementTypeDescriptor` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/LibraryTest.java[tags=testContainerElementTypeDescriptor] ---- @@ -262,7 +262,7 @@ shows an example. [[metadata-example-using-groupconversiondescriptor]] .Using `GroupConversionDescriptor` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/CarTest.java[tags=testGroupConversionDescriptor] ---- @@ -285,7 +285,7 @@ constraint's annotation type and its validators from a `ConstraintDescriptor`. [[metadata-example-using-constraintdescriptor]] .Using `ConstraintDescriptor` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter10/CarTest.java[tags=testConstraintDescriptor] ---- diff --git a/documentation/src/main/asciidoc/ch11.asciidoc b/documentation/src/main/asciidoc/_ch11.adoc similarity index 98% rename from documentation/src/main/asciidoc/ch11.asciidoc rename to documentation/src/main/asciidoc/_ch11.adoc index a765e4d5b3..322a21408e 100644 --- a/documentation/src/main/asciidoc/ch11.asciidoc +++ b/documentation/src/main/asciidoc/_ch11.adoc @@ -68,7 +68,7 @@ configuration in _hibernate.cfg.xml_: [[example-beanvalidationeventlistener-config]] .Manual configuration of `BeanValidationEvenListener` ==== -[source, XML] +[source, xml] ---- @@ -120,7 +120,7 @@ specification. [[example-jsf2]] .Usage of Jakarta Validation within JSF2 ==== -[source, XML] +[source, xml] ---- @@ -186,7 +186,7 @@ instances and use them in your managed beans. Just annotate instance fields of y [[example-dependency-injection]] .Retrieving validator factory and validator via `@Inject` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/validator/RentalStation.java[tags=include] ---- @@ -203,7 +203,7 @@ validator from Hibernate Validator are injected by annotating the injection poin [[example-dependency-injection-using-hv]] .Using the `@HibernateValidator` qualifier annotation ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/validator/qualifier/RentalStation.java[tags=include] ---- @@ -230,7 +230,7 @@ logic. [[example-constraint-validator-injected-bean]] .Constraint validator with injected bean ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/injection/ValidLicensePlateValidator.java[tags=include] ---- @@ -260,12 +260,12 @@ You can see an example in <>. [[example-cdi-method-validation]] .CDI managed beans with method-level constraints ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/methodvalidation/RentalStation.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/methodvalidation/RentCarRequest.java[tags=include] ---- @@ -307,7 +307,7 @@ INF/validation.xml__. [[example-using-validateonexecution]] .Using `@ValidateOnExecution` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/methodvalidation/configuration/RentalStation.java[tags=include] ---- @@ -342,12 +342,12 @@ and the validation interceptor kicks in when the methods on `ExpressRentalStatio [[example-using-executabletype-implicit]] .Using `ExecutableType.IMPLICIT` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/methodvalidation/implicit/RentalStation.java[tags=include] ---- -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter11/cdi/methodvalidation/implicit/ExpressRentalStation.java[tags=include] ---- @@ -363,7 +363,7 @@ managed objects such as EJBs etc., as shown in < >. [[example-constraint-mapping]] .Programmatic constraint declaration ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/constraintapi/ConstraintApiTest.java[tags=constraintMapping] ---- @@ -221,7 +221,7 @@ you can use `GenericConstraintDef` as seen in < [[example-constraint-validator-setting-dynamic-payload]] .`ConstraintValidator` implementation setting a dynamic payload ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/dynamicpayload/ValidPassengerCountValidator.java[tags=include] ---- @@ -413,7 +413,7 @@ unwrapped to `HibernateConstraintViolation` in order to retrieve the dynamic pay [[example-retrieving-dynamic-payload]] .Retrieval of a ``ConstraintViolation``'s dynamic payload ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/dynamicpayload/DynamicPayLoadTest.java[tags=include] ---- @@ -442,14 +442,14 @@ Hibernate Validator provides ways to override these defaults when boostrapping t To change the Expression Language feature level for constraints, use the following: -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/el/ElFeaturesTest.java[tags=constraints] ---- To change the Expression Language feature level for custom violations, use the following: -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/el/ElFeaturesTest.java[tags=customViolations] ---- @@ -514,7 +514,7 @@ The following example shows how to set the Hibernate Validator default locale to [[example-configure-default-locale]] .Configure the default locale ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/localization/LocalizationTest.java[tags=default-locale] ---- @@ -533,7 +533,7 @@ you could extract the header from the `ResteasyContext`. [[example-locale-resolver]] .Fine tune the locale used to interpolate the messages via a `LocaleResolver` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/localization/LocalizationTest.java[tags=locale-resolver] ---- @@ -567,7 +567,7 @@ or `HibernateConstraintValidatorContext#addMessageParameter(String, Object)`. [[example-custom-expression-variable]] .Custom `@Future` validator injecting an expression variable ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/context/MyFutureValidator.java[tags=include] ---- @@ -576,7 +576,7 @@ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/context/My [[example-custom-message-parameter]] .Custom `@Future` validator injecting a message parameter ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/context/MyFutureValidatorMessageParameter.java[tags=include] ---- @@ -605,7 +605,7 @@ this to avoid arbitrary code execution or sensitive data leak if message templat It is possible to enable Expression Language for a given custom violation by using `enableExpressionLanguage()` as shown in the example below: -[source] +[source, java] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/elinjection/SafeValidator.java[tags=include] ---- @@ -634,7 +634,7 @@ if the user input contains valid expressions, they will be executed by the Expre Here is an example of something you should **ABSOLUTELY NOT** do: -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter06/elinjection/UnsafeValidator.java[tags=include] ---- @@ -655,7 +655,7 @@ bundle. If you have any other use cases, let us know. [[example-custom-message-interpolator-context]] .`HibernateMessageInterpolatorContext` ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{engine-sourcedir}/org/hibernate/validator/messageinterpolation/HibernateMessageInterpolatorContext.java[lines=22..58] ---- @@ -719,7 +719,7 @@ for an example. [[example-using-service-file-for-constraint-definitions]] ._META-INF/services/jakarta.validation.ConstraintValidator_ ==== -[source] +[source, properties] ---- # Assuming a custom constraint annotation @org.mycompany.CheckCase org.mycompany.CheckCaseValidator @@ -752,7 +752,7 @@ definitions. You can use the programmatic constraint declaration API - see [[example-using-constraint-definition-api]] .Adding constraint definitions through the programmatic API ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/constraintapi/ConstraintApiTest.java[tags=constraintDefinition] ---- @@ -764,7 +764,7 @@ and `ConstraintValidatorContext` is not used), you also can use this alternative [[example-using-constraint-definition-api-lambda]] .Adding constraint definition with a Lambda expression ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/constraintapi/ConstraintApiTest.java[tags=constraintDefinitionUsingLambda] ---- @@ -784,7 +784,7 @@ However, there is also a purely regular expression based version available, whic the programmatic constraint declaration API: .Using the programmatic constraint declaration API to register a regular expression based constraint definition for `@URL` -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/constraintapi/ConstraintApiTest.java[tags=urlValidationOverride] ---- @@ -811,7 +811,7 @@ you may provide a specific class loader for loading these resources when bootstr [[example-using-external-class-loader]] .Providing a class loader for loading external resources and classes ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/classloading/ClassLoadingTest.java[tags=setupValidator] ---- @@ -852,7 +852,7 @@ as illustrated in <>. [[example-using-fluent-api-pattern]] .A class that uses non-standard getters ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/getterselectionstrategy/User.java[tags=include] ---- @@ -863,7 +863,7 @@ by the standard strategy. .Validating a class with non-standard getters using the default getter property selection strategy ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/getterselectionstrategy/GetterPropertySelectionStrategyTest.java[tags=no-strategy] ---- @@ -875,7 +875,7 @@ In this particular case, a possible implementation of the strategy would be: .Custom `GetterPropertySelectionStrategy` implementation ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/getterselectionstrategy/FluentGetterPropertySelectionStrategy.java[tags=include] ---- @@ -889,7 +889,7 @@ programmatically (see <>) or by using t [[custom-getter-strategy-programmatically]] .Configuring a custom `GetterPropertySelectionStrategy` programmatically ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/getterselectionstrategy/GetterPropertySelectionStrategyTest.java[tags=custom-strategy] ---- @@ -898,7 +898,7 @@ include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/gettersele [[custom-getter-strategy-xml]] .Configuring a custom `GetterPropertySelectionStrategy` using an XML property ==== -[source, XML, indent=0] +[source, xml, indent=0] ---- include::{resourcesdir}/org/hibernate/validator/referenceguide/chapter12/getter-property-selection-strategy-validation.xml[] ---- @@ -919,7 +919,7 @@ Imagine that we have a simple data class that has `@NotNull` constraints on some [[example-person-class]] .Person data class ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/nodenameprovider/Person.java[tags=include] ---- @@ -929,7 +929,7 @@ This class can be serialized to JSON by using the https://github.com/FasterXML/j [[example-person-object-to-json]] .Serializing Person object to JSON ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/nodenameprovider/PersonSerializationTest.java[tags=include] ---- @@ -939,7 +939,7 @@ As we can see, the object is serialized to: [[example-person-json]] .Person as json ==== -[source, indent=0] +[source, json, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/nodenameprovider/clarkKent.json[] ---- @@ -961,7 +961,7 @@ One example of how to do this is to leverage the Jackson API: [[example-jackson-property-node-name-provider]] .JacksonPropertyNodeNameProvider implementation ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/nodenameprovider/JacksonPropertyNodeNameProvider.java[tags=include] ---- @@ -971,7 +971,7 @@ And when doing the validation: [[example-jackson-property-node-name-provider-field]] .JacksonPropertyNodeNameProvider usage ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/nodenameprovider/JacksonPropertyNodeNameProviderTest.java[tags=field] ---- @@ -983,7 +983,7 @@ Note that this also works when the annotations are on a getter: [[example-jackson-property-node-name-provider-getter]] .Annotation on a getter ==== -[source, JAVA, indent=0] +[source, java, indent=0] ---- include::{sourcedir}/org/hibernate/validator/referenceguide/chapter12/nodenameprovider/JacksonPropertyNodeNameProviderTest.java[tags=getter] ---- @@ -1022,12 +1022,12 @@ It can be done either programmatically (< @@ -143,7 +143,7 @@ for http://ant.apache.org/[Apache Ant]: .Using the annotation processor with Ant ==== -[source, XML] +[source, xml] [subs="verbatim,attributes"] ---- 3.2.0 - 5.1.2.Final - 3.1.1.Final + 6.0.2.Final + 3.2.0.Final 3.0.0 2.3.19 @@ -727,6 +727,16 @@ rootProject.directory + + parse-project-version + + parse-version + + + parsed-version.org.hibernate.validator + ${project.version} + + parse-jakarta-validation-spec-version