You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2014/04/07 21:57:14 UTC
[jira] [Commented] (SANDBOX-464) Add support for interpreting
property expressions
[ https://issues.apache.org/jira/browse/SANDBOX-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13962189#comment-13962189 ]
Benedikt Ritter commented on SANDBOX-464:
-----------------------------------------
Hello André,
sorry for the late reply, I was a bit busy lately. So here are my thoughts to your comments above.
bq. So by allowing both it is a mitigation of the fluent API itself and may lead to very poor code \[3\].
The point you're missing here is, that property expression will most certainly be constructed at runtime and not at development time. Sure, if I know how I want to query the object graph, I'll use the fluent API (or even better: the access methods directly ;-) ). What I'm thinking about here is the case where the path is constructed from somewhere with the information "get the fifth item". The code would look something like:
{code:java}
String path = ...
int pos = ...
on(bean).get(path + "[" + pos + "]");
{code}
Compare that to:
{code:java}
String path = ...
int pos = ...
on(bean).getIndexed(path).at(pos);
{code}
bq. Allowing \[3\], which is what you are thinking of in your comment above, would IMHO permit and encourage the user to mix everything up.
Don't treat your users as complete idiots :-)
Thoughts?
Benedikt
> Add support for interpreting property expressions
> -------------------------------------------------
>
> Key: SANDBOX-464
> URL: https://issues.apache.org/jira/browse/SANDBOX-464
> Project: Commons Sandbox
> Issue Type: Task
> Components: BeanUtils2
> Affects Versions: Nightly Builds
> Reporter: Benedikt Ritter
> Attachments: Commons-Sandbox-464-Get.patch
>
>
> BeanUtils 1 has the functionality to interpret property paths. For example the call:
> {code:java}
> BeanUtils.getProperty("adress.street", person);
> {code}
> would first get the address of the given person and then get the street from the address and return it. The same is possible for list and mapped properties.
> In order to be supplement for BeanUtils1, we need to implement this in BeanUtils2.
--
This message was sent by Atlassian JIRA
(v6.2#6252)