Return-Path: Delivered-To: apmail-activemq-camel-dev-archive@locus.apache.org Received: (qmail 77444 invoked from network); 10 Dec 2008 11:56:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Dec 2008 11:56:08 -0000 Received: (qmail 95699 invoked by uid 500); 10 Dec 2008 11:56:17 -0000 Delivered-To: apmail-activemq-camel-dev-archive@activemq.apache.org Received: (qmail 95683 invoked by uid 500); 10 Dec 2008 11:56:17 -0000 Mailing-List: contact camel-dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-dev@activemq.apache.org Received: (qmail 95672 invoked by uid 99); 10 Dec 2008 11:56:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Dec 2008 03:56:17 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 74.125.92.149 as permitted sender) Received: from [74.125.92.149] (HELO qw-out-1920.google.com) (74.125.92.149) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Dec 2008 11:54:47 +0000 Received: by qw-out-1920.google.com with SMTP id 9so144702qwj.26 for ; Wed, 10 Dec 2008 03:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=iKFtuxR8ATuctw3+wcNg9xZuKvBWl30joDHu/XNCkqE=; b=sl0WAZVqF/CPpL3/9C/bQte303s+lyUz8r7zFsi5vGW28dsPKngGdNw13RgJ4hOvgQ Gxi18WxMb1gXlkpi7QxjplnEpMN3EjP/vnyYYR12BwAJau0KKcQ1nmCssE3/ctjSuTX2 74/jrSFkEQZR876mGwy7Y2cAVtS2vGCoIHplc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=n//50EmQerqq8j6D3ut+2yLp4i1v/Xre5XKyluv3awFrZzEeO4I1BG9DsEBHbgUEAw uBn3jlPx9O3eu2qB/oTQPux62b5P0asPUUVCg3HgKu0f/25st+/5C+T8OmS6UKUG59Ss J+Citga1vTbAE9mf1bEy41L8V8y83XiqUb5+g= Received: by 10.214.80.3 with SMTP id d3mr1835707qab.69.1228910135221; Wed, 10 Dec 2008 03:55:35 -0800 (PST) Received: by 10.214.216.9 with HTTP; Wed, 10 Dec 2008 03:55:35 -0800 (PST) Message-ID: <5380c69c0812100355g4e798940r5b222d9834b6a43c@mail.gmail.com> Date: Wed, 10 Dec 2008 12:55:35 +0100 From: "Claus Ibsen" To: camel-dev@activemq.apache.org Subject: Re: [HEADS-UP] - Minor ObjectHelper refact to align null and empty check In-Reply-To: <5380c69c0812100348jf4d8dddy1a01958fab5441f9@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5380c69c0812100348jf4d8dddy1a01958fab5441f9@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi Oh the remaining minor issue is whether we should also change the ObjectHelper.notNull method name to be aligned with the isXXX methods From: ObjectHelper.notNull To ObjectHelper.notEmpty As it's used in many components I didn't change the name right away. Any objections, otherwise I might fix when I need to do some trivial work ;) /Claus Ibsen Apache Camel Committer Blog: http://davsclaus.blogspot.com/ On Wed, Dec 10, 2008 at 12:48 PM, Claus Ibsen wrote: > Hi > > Ticket: CAMEL-1155 > > #1 > I have aligned the various isNotNullOrNonEmpty / isBlank etc. methods > in ObjectHelper into two combined methods. > > These old methods have been removed in Camel 2.0 > - isNotNullAndNonEmpty > - isNullOrBlank > > And replaced with (see below) > > #2 > I have also refined the notNull methods to use these new test methods > so we test for both null and if its a String type if the string is > empty as well. > > I have added a variation of the notNull tester with a 3rd parameter = > on. This parameter is appended to the message being thrown. This helps > end users to identify where the problem is. > In the various model types we can use this 3 parameter passing in > *this*. So the error reported will output the toString of the node, so > it's like > > For instance this route will use a bean with the id=hello > from("direct:in").processRef("hello"); > > But if the bean is not in the registry you now get this error message: > registry entry called hello must be specified on: process[ref: hello] > Instead of just: > registry entry called hello must be specified > > > > New methods to use > =============== > > public static void notNull(Object value, String name, Object on) { > > > /** > * Tests whether the value is null or an empty string. > * > * @param value the value, if its a String it will be tested for > text length as well > * @return true if empty > */ > public static boolean isEmpty(Object value) { > > /** > * Tests whether the value is not null or an empty string. > * > * @param value the value, if its a String it will be tested for > text length as well > * @return true if not empty > */ > public static boolean isNotEmpty(Object value) { > > > > > > /Claus Ibsen > Apache Camel Committer > Blog: http://davsclaus.blogspot.com/ >