commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [SANDBOX][BEANUTILS2] Property expressions
Date Fri, 02 May 2014 17:54:16 GMT
Nah, I'm just talking around the water cooler,  thinking aloud...

Gary

<div>-------- Original message --------</div><div>From: Benedikt Ritter
<britter@apache.org> </div><div>Date:05/02/2014  12:59  (GMT-05:00) </div><div>To:
Commons Developers List <dev@commons.apache.org> </div><div>Subject: Re:
[SANDBOX][BEANUTILS2] Property expressions </div><div>
</div>So you're saying we should leave this out of BU2?


2014-05-02 12:55 GMT+02:00 Gary Gregory <garydgregory@gmail.com>:

> There is also our own jxpath.
>
> Gary
>
> <div>-------- Original message --------</div><div>From: Benedikt Ritter
<
> britter@apache.org> </div><div>Date:05/02/2014  06:40  (GMT-05:00)
> </div><div>To: Commons Developers List <dev@commons.apache.org>
> </div><div>Subject: [SANDBOX][BEANUTILS2] Property expressions </div><div>
> </div>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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message