You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2015/05/09 12:25:01 UTC

[jira] [Issue Comment Deleted] (LANG-1134) New methods for lang3.Validate

     [ https://issues.apache.org/jira/browse/LANG-1134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benedikt Ritter updated LANG-1134:
----------------------------------
    Comment: was deleted

(was: Okay, if you really absolutely don't what to get involved, I can't force you. But changes are higher that this will make it into a release, if code is provided. You can't break anything, we have a good test coverage and your changes will be reviewed by one of our committers.

So if you decide to give it a try, it's pretty easy:
* Go to GitHub and create a fork of the Commons Lang repository: https://github.com/apache/commons-lang/
* Go to your fork and clone it to you machine with {{git clone git@github.com:<your github user name>/commons-lang.git}} (Note that you have to have a key pair set up at github)
* Create a branch to implement the functionality with {{git checkout -b LANG-1134}}
* Implement the functionality
** Write some JUnit tests
** use mvn clean verify to check if everything is working
* when finished push your changes back to your github for with {{git push -u origin LANG-1134}}
* Go to you fork on GitHub
* Click the "Create Pull Request button")

> 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
>            Priority: Minor
>             Fix For: Patch Needed
>
>
> 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)