commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1134) New methods for lang3.Validate
Date Fri, 15 May 2015 00:37:01 GMT

    [ https://issues.apache.org/jira/browse/LANG-1134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14544678#comment-14544678
] 

ASF GitHub Bot commented on LANG-1134:
--------------------------------------

Github user coveralls commented on the pull request:

    https://github.com/apache/commons-lang/pull/87#issuecomment-102210032
  
    
    [![Coverage Status](https://coveralls.io/builds/2568427/badge)](https://coveralls.io/builds/2568427)
    
    Coverage increased (+0.05%) to 93.32% when pulling **41e83754024b6b7f32063f7d8bd511d88edb2ff7
on Lady-Stardust:LANG-1134** into **71d7c3264239c55b6e2daf89c44c5685085f26dd on apache:master**.



> 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)

Mime
View raw message