On Mon, 30 Dec 2024 at 14:43, <ggreg...@apache.org> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> ggregory pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/commons-validator.git
>
> commit d1062ee134753b8a321ac11206a5a31b89bedef8
> Author: Gary D. Gregory <garydgreg...@gmail.com>
> AuthorDate: Mon Dec 30 09:42:48 2024 -0500
>
>     Deprecate Validator protected instance variable access for getter
>     methods
>
>     - Add Validator.getFieldName()
>     - Add Validator.getParameters()
>     - Add Validator.getResources()

-1: the getters should be protected, like the fields.

> ---
>  src/changes/changes.xml                            |  4 ++
>  .../org/apache/commons/validator/Validator.java    | 55 
> ++++++++++++++++++++++
>  2 files changed, 59 insertions(+)
>
> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> index db5782e3..9bf3119b 100644
> --- a/src/changes/changes.xml
> +++ b/src/changes/changes.xml
> @@ -73,6 +73,7 @@ The <action> type attribute can be add,update,fix,remove.
>      <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate 
> GenericTypeValidator.GenericTypeValidator().</action>
>      <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate 
> GenericValidator.GenericValidator().</action>
>      <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate 
> ValidatorUtils.ValidatorUtils().</action>
> +    <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate 
> Validator protected instance variable access for getter methods.</action>
>      <!-- ADD -->
>      <action type="add" issue="VALIDATOR-497" dev="sjaranowski" 
> due-to="Slawomir Jaranowski">IBANValidator: add method validate with 
> validation status</action>
>      <action type="add" dev="sebb">DomainValidatorTest: added Maven profile 
> to simplfy execution.</action>
> @@ -80,6 +81,9 @@ The <action> type attribute can be add,update,fix,remove.
>      <action type="add" dev="sjaranowski" due-to="Slawomir 
> Jaranowski">Improve IBANValidatorTest by using registry from swift.</action>
>      <action type="add" dev="sebb" issue="VALIDATOR-495" due-to="Slawomir 
> Jaranowski">IBANValidator: add Yemen.</action>
>      <action type="add" dev="ggregory" due-to="Leonard Wicke, Gary 
> Gregory">Add IBANValidator.Validator.getIbanLength().</action>
> +    <action type="add" dev="ggregory" due-to="nullwli, Gary Gregory">Add 
> Validator.getFieldName()</action>
> +    <action type="add" dev="ggregory" due-to="nullwli, Gary Gregory">Add 
> Validator.getParameters()</action>
> +    <action type="add" dev="ggregory" due-to="nullwli, Gary Gregory">Add 
> Validator.getResources()</action>
>      <!-- UPDATE -->
>      <action type="update" dev="sebb">DomainValidator: Changes from 
> 2024121700, Last Updated Tue Dec 17 07:07:01 2024 UTC.</action>
>      <action type="update" dev="sebb">IBANValidatorTest: parameterise SWIFT 
> registry version; update to v99</action>
> diff --git a/src/main/java/org/apache/commons/validator/Validator.java 
> b/src/main/java/org/apache/commons/validator/Validator.java
> index 513fbb6d..037b487a 100644
> --- a/src/main/java/org/apache/commons/validator/Validator.java
> +++ b/src/main/java/org/apache/commons/validator/Validator.java
> @@ -89,29 +89,45 @@ public class Validator implements Serializable {
>
>      /**
>       * The Validator Resources.
> +     *
> +     * @deprecated Use {@link #getResources()}.
>       */
> +    @Deprecated
>      protected ValidatorResources resources;
>
>      /**
>       * The name of the form to validate
> +     *
> +     * @deprecated Use {@link #getFormName()}.
>       */
> +    @Deprecated
>      protected String formName;
>
>      /**
>       * The name of the field on the form to validate
> +     *
>       * @since 1.2.0
> +     *
> +     * @deprecated Use {@link #getFieldName()}.
>       */
> +    @Deprecated
>      protected String fieldName;
>
>      /**
>       * Maps validation method parameter class names to the objects to be 
> passed
>       * into the method.
> +     *
> +     * @deprecated Use {@link #getParameters()}.
>       */
> +    @Deprecated
>      protected Map<String, Object> parameters = new HashMap<>(); // <String, 
> Object>
>
>      /**
>       * The current page number to validate.
> +     *
> +     * @deprecated Use {@link #getPage()}.
>       */
> +    @Deprecated
>      protected int page;
>
>      /**
> @@ -119,18 +135,27 @@ public class Validator implements Serializable {
>       * If not specified, the context class loader, or the class loader
>       * used to load Digester itself, is used, based on the value of the
>       * {@code useContextClassLoader} variable.
> +     *
> +     * @deprecated Use {@link #getClassLoader()}.
>       */
> +    @Deprecated
>      protected transient ClassLoader classLoader;
>
>      /**
>       * Whether or not to use the Context ClassLoader when loading classes
>       * for instantiating new objects.  Default is {@code false}.
> +     *
> +     * @deprecated Use {@link #getUseContextClassLoader()}.
>       */
> +    @Deprecated
>      protected boolean useContextClassLoader;
>
>      /**
>       * Sets this to true to not return Fields that pass validation.  Only 
> return failures.
> +     *
> +     * @deprecated Use {@link #getOnlyReturnErrors()}.
>       */
> +    @Deprecated
>      protected boolean onlyReturnErrors;
>
>      /**
> @@ -226,6 +251,16 @@ public class Validator implements Serializable {
>          return this.getClass().getClassLoader();
>      }
>
> +    /**
> +     * Gets the field name.
> +     *
> +     * @return the field name.
> +     * @since 1.10.0
> +     */
> +    public String getFieldName() {

-1: this changes access from protected to public

> +        return fieldName;
> +    }
> +
>      /**
>       * Gets the form name which is the key to a set of validation rules.
>       * @return the name of the form.
> @@ -257,6 +292,16 @@ public class Validator implements Serializable {
>          return page;
>      }
>
> +    /**
> +     * Gets the parameter map.
> +     *
> +     * @return the parameter map.
> +     * @since 1.10.0
> +     */
> +    public Map<String, Object> getParameters() {

-1: this changes access from protected to public

> +        return parameters;
> +    }
> +
>      /**
>       * Returns the value of the specified parameter that will be used during 
> the
>       * processing of validations.
> @@ -269,6 +314,16 @@ public class Validator implements Serializable {
>          return parameters.get(parameterClassName);
>      }
>
> +    /**
> +     * Gets the validator resource.
> +     *
> +     * @return the validator resource.
> +     * @since 1.10.0
> +     */
> +    public ValidatorResources getResources() {

-1: this changes access from protected to public

> +        return resources;
> +    }
> +
>      /**
>       * Gets the boolean as to whether the context classloader should be used.
>       * @return whether the context classloader should be used.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to