Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 940F2200B7F for ; Sun, 11 Sep 2016 15:42:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 87A9E160AC7; Sun, 11 Sep 2016 13:42:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CB040160AAA for ; Sun, 11 Sep 2016 15:42:21 +0200 (CEST) Received: (qmail 26773 invoked by uid 500); 11 Sep 2016 13:42:20 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 26721 invoked by uid 99); 11 Sep 2016 13:42:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Sep 2016 13:42:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id B42D32C1B7F for ; Sun, 11 Sep 2016 13:42:20 +0000 (UTC) Date: Sun, 11 Sep 2016 13:42:20 +0000 (UTC) From: "Benedikt Ritter (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1134) New methods for lang3.Validate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 11 Sep 2016 13:42:22 -0000 [ https://issues.apache.org/jira/browse/LANG-1134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15481775#comment-15481775 ] Benedikt Ritter commented on LANG-1134: --------------------------------------- I don't think the design is ready to be shipped with 3.5. `differentObj` is a bad method name. If could be `differentObject`. Furthermore I don't understand why we need to use a `Comparator` to decide whether the objects a different from one another. I would this to be tested using `Object.equals`. > 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)