You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2025/10/18 14:29:22 UTC
(causeway) 10/17: CAUSEWAY-3866: updates references to javax.validation.constraints and javax.annotation
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch CAUSEWAY-3866
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit f8c4ec57881bcda85285bd1156046dc5296b75c5
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Oct 17 14:16:26 2025 +0100
CAUSEWAY-3866: updates references to javax.validation.constraints and javax.annotation
---
.../refguide/modules/applib-ant/pages/Digits.adoc | 4 +-
.../modules/applib-ant/pages/Nullable.adoc | 4 +-
.../refguide/modules/applib-ant/pages/Pattern.adoc | 47 ++++++++--------------
.../modules/applib-ant/partials/about/jee.adoc | 6 +--
.../properties-collections-actions/actions.adoc | 13 +++---
5 files changed, 27 insertions(+), 47 deletions(-)
diff --git a/antora/components/refguide/modules/applib-ant/pages/Digits.adoc b/antora/components/refguide/modules/applib-ant/pages/Digits.adoc
index 5f405655164..636d84ce7f0 100644
--- a/antora/components/refguide/modules/applib-ant/pages/Digits.adoc
+++ b/antora/components/refguide/modules/applib-ant/pages/Digits.adoc
@@ -4,9 +4,7 @@
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...]
-// TODO: 3866 - remove
-
-The `@javax.validation.constraints.Digits` annotation is recognized by Apache Causeway as a means to specify the precision for properties and action parameters of type `java.math.BigDecimal`.
+The `@jakarta.validation.constraints.Digits` annotation is recognized by Apache Causeway as a means to specify the precision for properties and action parameters of type `java.math.BigDecimal`.
For example:
diff --git a/antora/components/refguide/modules/applib-ant/pages/Nullable.adoc b/antora/components/refguide/modules/applib-ant/pages/Nullable.adoc
index e23ded529ff..47645df9e1e 100644
--- a/antora/components/refguide/modules/applib-ant/pages/Nullable.adoc
+++ b/antora/components/refguide/modules/applib-ant/pages/Nullable.adoc
@@ -1,5 +1,5 @@
-[#javax-annotation-Nullable]
-= @Nullable (javax.validation)
+[#jakarta-annotation-Nullable]
+= @Nullable (jakarta.annotation)
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...]
diff --git a/antora/components/refguide/modules/applib-ant/pages/Pattern.adoc b/antora/components/refguide/modules/applib-ant/pages/Pattern.adoc
index de330fed4ea..87da06ca72b 100644
--- a/antora/components/refguide/modules/applib-ant/pages/Pattern.adoc
+++ b/antora/components/refguide/modules/applib-ant/pages/Pattern.adoc
@@ -1,57 +1,42 @@
-[#javax-validation-constraints-Pattern]
-= @Pattern (javax.validation)
+[#jakarta-validation-constraints-Pattern]
+= @Pattern (jakarta.validation.constraints)
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...]
-// TODO: 3866 - remove
-
-The `@javax.validation.constraints.Pattern` annotation is recognized by Apache Causeway as a means to specify a regular expression constraint for properties and action parameters of type `java.lang.String`.
+The `@jakarta.validation.constraints.Pattern` annotation is recognized by Apache Causeway as a means to specify a regular expression constraint for properties and action parameters of type `java.lang.String`.
For example, here's the annotation being used on an action parameter:
[source,java]
----
+import jakarta.validation.constraints.Pattern;
+
public Customer updateName(
- @javax.validation.constraints.Pattern(
- regexp="[A-Z].+"
- message="Must begin with a capital."
- )
- final String name) {
+ @Pattern(
+ regexp="[A-Z].+",
+ message="Must begin with a capital."
+ )
+ final String name) {
setName(name);
- return this
+ return this;
}
-...
+// ...
----
and here's an example of its use on a property:
[source,java]
----
-@javax.validation.constraints.Pattern(
- regexp="[A-Z].+"
- message="Must begin with a capital."
-)
-public String getName() {
- return name;
-}
-...
-----
-
-
-For properties, it is also possible to specify against a field if Lombok is being used:
-
-[source,java]
-----
-import javax.validation.constraints.Pattern;
-import lombok.Getter;
-import lombok.Setter;
+import jakarta.validation.constraints.Pattern;
@Pattern(
- regexp="[A-Z].+"
+ regexp="[A-Z].+",
message="Must begin with a capital."
)
@Getter @Setter
private String name;
+...
----
+
diff --git a/antora/components/refguide/modules/applib-ant/partials/about/jee.adoc b/antora/components/refguide/modules/applib-ant/partials/about/jee.adoc
index 30ac8da52a5..43eb9712500 100644
--- a/antora/components/refguide/modules/applib-ant/partials/about/jee.adoc
+++ b/antora/components/refguide/modules/applib-ant/partials/about/jee.adoc
@@ -16,20 +16,20 @@ The table below lists the JEE annotations currently recognized.
|Purpose
|Layer
-|xref:refguide:applib-ant:Digits.adoc[`@javax.validation.` +
+|xref:refguide:applib-ant:Digits.adoc[`@jakarta.validation.` +
`constraints.` +
`Digits`]
|Precision/scale for BigDecimal values.
|Domain
-|xref:refguide:applib-ant:Pattern.adoc[`@javax.validation.` +
+|xref:refguide:applib-ant:Pattern.adoc[`@jakarta.validation.` +
`constraints.` +
`Pattern`]
|Regular expressions for strings
|Domain
-|xref:refguide:applib-ant:Digits.adoc[`@javax.annotation.` +
+|xref:refguide:applib-ant:Digits.adoc[`@jakarta.annotation.` +
`Nullable`]
|Specify that a property/parameter is optional.
|Domain
diff --git a/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/actions.adoc b/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/actions.adoc
index 705918793d4..033bfbfb8b0 100644
--- a/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/actions.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/actions.adoc
@@ -253,33 +253,30 @@ See also xref:userguide:ROOT:meta-annotations.adoc#properties-vs-parameters[prop
== ``BigDecimal``s (Precision)
-The xref:refguide:applib-ant:Digits.adoc[@javax.validation.constraints.Digits#fraction] annotation/attribute is used to specify the scale/precision of decimals.
+The xref:refguide:applib-ant:Digits.adoc[@jakarta.validation.constraints.Digits#fraction] annotation/attribute is used to specify the scale/precision of decimals.
For example:
[source,java]
----
import jakarta.persistence.Column;
+import jakarta.validation.constraints.Digits;
import lombok.Getter;
import lombok.Setter;
public Order updateDiscount(
- @javax.validation.constraints.Digits(fraction=2) // <.>
+ @Digits(fraction=2) // <.>
@ParameterLayout(named="Discount rate")
String discountRate) {
setDiscountRate(discountRate);
return this;
}
-@Column(scale=2) // <.>
+@Column(scale=2) // <.>
@Getter @Setter
private BigDecimal discountRate;
----
<.> Specifies the parameter precision using xref:refguide:applib-ant:Digits.adoc[@Digits#fraction].
-<.> Specifies the corresponding property precision.
-+
-Note that this uses an ORM-specific annotation (in this case, xref:refguide:applib-ant:Column.adoc#lengthscale-for-bigdecimals[@Column#scale]
-
-
+<.> Specifies the corresponding property precision for the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] object store.