Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0154211553 for ; Tue, 20 May 2014 08:47:26 +0000 (UTC) Received: (qmail 98018 invoked by uid 500); 20 May 2014 08:47:25 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 97879 invoked by uid 500); 20 May 2014 08:47:25 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 97871 invoked by uid 99); 20 May 2014 08:47:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2014 08:47:25 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yogu13@gmail.com designates 209.85.216.175 as permitted sender) Received: from [209.85.216.175] (HELO mail-qc0-f175.google.com) (209.85.216.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2014 08:47:21 +0000 Received: by mail-qc0-f175.google.com with SMTP id w7so223511qcr.20 for ; Tue, 20 May 2014 01:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=byhnUu5XK69mc/sYFHBfOY9+7Cyc83iYnTQUxvzcn7I=; b=aRuzxSUT7aPZvrus+GX/90XcyY81f6qtXPmo/nOSuhVitPBbsV5/pQUAMiLTiScfkc TkSauEyAvEOjnlXYzuGyI8NlgXKAyaPMM1shrj86h4l3IGPEdA6LdGiOCujSJTIkYges Ul4fp/m8k913WA6ne7nVBevTjB0tgCYT8pM9q2EG7PdOowEGy4evTeKuYRSoWetSdGnr 9kuqvbJa1DGw/BymNyoUXSk5sJqjUGr2xZXKZSpkrTM1tdTz971kgz1CPUaezLRKMzdD kqfxiIZ4W1KAhUt3EevgzxsQU5+jYn+jOEwDvGGvp8WMjC+rcTCEw/rrL0b8xLdpIJai dsHg== MIME-Version: 1.0 X-Received: by 10.140.26.39 with SMTP id 36mr17527878qgu.111.1400575620934; Tue, 20 May 2014 01:47:00 -0700 (PDT) Received: by 10.96.160.169 with HTTP; Tue, 20 May 2014 01:47:00 -0700 (PDT) In-Reply-To: References: Date: Tue, 20 May 2014 14:17:00 +0530 Message-ID: Subject: Re: [SANDBOX][BEANUTILS2] Property expressions From: Yogesh Rao To: Commons Developers List Content-Type: multipart/alternative; boundary=001a11c125ea5df2ba04f9d0ecf7 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c125ea5df2ba04f9d0ecf7 Content-Type: text/plain; charset=UTF-8 How about giving the user the options 1. go the traditional way of calling the series of get methods and perform the operation or 2. the pure expression way (this wouldnt allow the user to mix with the first style) the 2nd option does seem very similar to what jxpath does for living, but having said this i am not very sure of all the feature it comes bundled with. Does it handle custom converters aswell? Regards, -Yogesh On Fri, May 2, 2014 at 11:24 PM, Gary Gregory wrote: > Nah, I'm just talking around the water cooler, thinking aloud... > > Gary > >
-------- Original message --------
From: Benedikt Ritter < > britter@apache.org>
Date:05/02/2014 12:59 (GMT-05:00) >
To: Commons Developers List >
Subject: Re: [SANDBOX][BEANUTILS2] Property expressions >
>
So you're saying we should leave this out of BU2? > > > 2014-05-02 12:55 GMT+02:00 Gary Gregory : > > > There is also our own jxpath. > > > > Gary > > > >
-------- Original message --------
From: Benedikt Ritter < > > britter@apache.org>
Date:05/02/2014 06:40 (GMT-05:00) > >
To: Commons Developers List > >
Subject: [SANDBOX][BEANUTILS2] Property expressions >
> >
Hi all, > > > > one of the goal of BeanUtils2 is to provide the same functionality as > > BeanUtils1. In BeanUtils1 you can do something like this: > > > > BeanUtils.getProperty(person, "address.city.zipCode"); > > > > This would be translated into: > > > > person.getAddress().getCity().getZipCode(); > > > > The same can be done with mapped and indexed properties: > > > > BeanUtils.getProperty(person, "contact(5).name"); > > > > which would be translated to: > > > > person.getContact(5).getName(); > > > > BeanUtils2 provides a fluent API where the first example would be done > via: > > > > on(person).get("address").get("city").get("zipCode") > > > > and the second: > > > > on(person).getIndexed("contact").at(5).get("name") > > > > We are currently thinking about how we can implement the property > > expressions. We are discussing this in SANDBOX-464 [1] and there is > already > > a patch. I'm currently unsure whether we should allow mixing up the > fluent > > API and property expressions. The contributor makes some good examples of > > what kind of awful code could be created: > > > > on(addressBook).get("provider(google).contact[5] > > > ").getMapped("address").with("home").get("street.yetAnotherNestedProperty") > > > > on the other hand I don't want to force people into doing stuff like > this: > > > > String path = ...int pos = ... > > on(bean).get(path + "[" + pos + "]"); > > > > > > Currently I'm tempted to allow mixing up both API styles, but I'd like to > > here your opinion first. > > > > Benedikt > > > > [1] https://issues.apache.org/jira/browse/SANDBOX-464 > > > > -- > > http://people.apache.org/~britter/ > > http://www.systemoutprintln.de/ > > http://twitter.com/BenediktRitter > > http://github.com/britter > > > > > > -- > http://people.apache.org/~britter/ > http://www.systemoutprintln.de/ > http://twitter.com/BenediktRitter > http://github.com/britter > --001a11c125ea5df2ba04f9d0ecf7--