This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch maven-4.0.x
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-4.0.x by this push:
new 669c33d273 [backport maven-4.0.x] #14067: [API] Add noun-style
accessors to generated model classes (deprecate getXxx()) (#14105)
669c33d273 is described below
commit 669c33d273e04a33761fd3b704cb46442bf0ebfc
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Nov 23 17:41:26 2026 +0100
[backport maven-4.0.x] #14067: [API] Add noun-style accessors to generated
model classes (deprecate getXxx()) (#14105)
---
src/mdo/model.vm | 46 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/src/mdo/model.vm b/src/mdo/model.vm
index 8ba871990e..b1e7825ac5 100644
--- a/src/mdo/model.vm
+++ b/src/mdo/model.vm
@@ -201,14 +201,42 @@ public class ${class.name}
#end
#if ( $class == $root )
- public String getNamespaceUri() {
+ /**
+ * The namespace URI of the model.
+ *
+ * @return a {@code String}
+ * @since 4.0.0
+ */
+ public String namespaceUri() {
return namespaceUri;
}
- public String getModelEncoding() {
+ /**
+ * @deprecated Use {@link #namespaceUri()} instead.
+ */
+ @Deprecated(since = "4.0.0", forRemoval = true)
+ public String getNamespaceUri() {
+ return namespaceUri();
+ }
+
+ /**
+ * The encoding used for the model.
+ *
+ * @return a {@code String}
+ * @since 4.0.0
+ */
+ public String modelEncoding() {
return modelEncoding;
}
+ /**
+ * @deprecated Use {@link #modelEncoding()} instead.
+ */
+ @Deprecated(since = "4.0.0", forRemoval = true)
+ public String getModelEncoding() {
+ return modelEncoding();
+ }
+
#end
#foreach ( $field in $class.getFields($version) )
#set ( $cap = $Helper.capitalise( $field.name ) )
@@ -225,6 +253,7 @@ public class ${class.name}
#end
*
* @return a {@code ${type}}
+ * @since 4.0.0
*/
#foreach( $ann in ${field.annotations} )
${ann}
@@ -232,10 +261,21 @@ public class ${class.name}
#if ( $field.type == "java.util.List" || $field.type ==
"java.util.Properties" )
@Nonnull
#end
- public ${type} ${pfx}${cap}() {
+ public ${type} ${field.name}() {
return this.${field.name};
}
+ /**
+ * @deprecated Use {@link #${field.name}()} instead.
+ */
+ @Deprecated(since = "4.0.0", forRemoval = true)
+ #if ( $field.type == "java.util.List" || $field.type ==
"java.util.Properties" )
+ @Nonnull
+ #end
+ public ${type} ${pfx}${cap}() {
+ return ${field.name}();
+ }
+
#end
#if ( $locationTracking && !$class.superClass )
/**