[
https://issues.apache.org/jira/browse/LANG-1134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15488714#comment-15488714
]
Stardust commented on LANG-1134:
--------------------------------
I addressed the issues discussed here.
I'm still not happy with the "Object" suffix for the comparison methods, but as
far as I can tell nothing better has been suggested.
"differentObject" is problematic. While I think it will be clear to anyone what
this method does, it somehow sounds like an identity test to me.
Also, I did as you told me last year to make new changes: edit the files and
make a new pull request. Thing is there has been other commits since my
original one and I didn't have the new files in my branch, I'm guessing this is
why Github is reporting a conflict. I do not know how to solve this.
> New methods for lang3.Validate
> ------------------------------
>
> Key: LANG-1134
> URL: https://issues.apache.org/jira/browse/LANG-1134
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.*
> Affects Versions: 3.4
> Reporter: Stardust
> Assignee: Charles Honton
> Priority: Minor
> Fix For: 3.5
>
>
> These are suggestions for new methods for the Validate class.
> h1. Floating point values
> h2. notNaN(value)
> Throws an exception if value != value .
> {code}double value;
> value = Double.NaN;
> Validate.notNaN(value); // Throws exception
> value = 1.0;
> Validate.notNaN(value); // Validates
> value = Double.POSITIVE_INFINITY;
> Validate.notNaN(value); // Validates{code}
> h2. finite(value)
> Validates that the argument contains a numeric value (not NaN or infinite).
> {code}double value;
> value = Double.NaN;
> Validate.finite(value); // Throws exception
> value = Double.POSITIVE_INFINITY;
> Validate.finite(value); // Throws exception
> value = 1.0;
> Validate.finite(value); // Validates{code}
> h1. Integers and floats
> The following methods are overloaded to accept both integers and floating
> point values.
> h2. greater(reference, value), greaterOrEqual(reference, value)
> Ensures the argument is greater than (or equal to) a given value.
> {code}double value;
> value = 0.0;
> Validate.greater(0.0, value); // Throws exception
> Validate.greaterOrEqual(0.0, value); // Validates
> value = Double.POSITIVE_INFINITY;
> Validate.greater(0.0, value); // Validates
> value = Double.NaN;
> Validate.greater(0.0, value); // Throws exception{code}
> h2. smaller(reference, value), smallerOrEqual(reference, value)
> Ensures the argument is smaller than (or equal to) a given value. Does the
> opposite of greater(), see example above.
> h2. different(reference, value)
> Ensures the argument is not equal to a given value. A typical use case would
> be to accept only non-zero values.
> {code}double value;
> value = 0.0;
> Validate.different(0.0, value); // Throws exception
> Validate.different(1.0, value); // Validates
> value = Double.NaN;
> Validate.different(0.0, value); // Validates{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)