[ 
https://issues.apache.org/jira/browse/SANDBOX-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13930903#comment-13930903
 ] 

Benedikt Ritter commented on SANDBOX-463:
-----------------------------------------

Hi,

let's keep it simple for now. The provided patch adds a few couple LoC and it 
is encapsulated by the public API. We can always change this later and make BU2 
depend on other libraries, if this doesn't fit.

Now back to the second version of the patch. I've reviewed it and it looks 
quite nice. Here are a few things I'm currently thinking about:

# The test is incomplete:
 * We should test invalid property expressions like "mappedProperty(First 
Key]", "(property)" or "$%&". 
 * What happens if I pass "nested..nested.mappedNested.value(key)" (with two 
dots)?
# I'm not sure whether {{Expression.interpret(BeanAccessor)}} is a good method 
name. The expression doesn't interpret the BeanAccessor. How about renaming it 
to {{Expression.applyTo(BeanAccessor)}} ?
# There is no need to recompile the Patterns in MappedExpression and 
IndexedExpression on every call. It can be initialized once into a static field.

WDYT?

Regards,
Benedikt

> Implementation of property paths 
> ---------------------------------
>
>                 Key: SANDBOX-463
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-463
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: BeanUtils2
>            Reporter: Andre Diermann
>         Attachments: Commons-Sandbox-463#2.patch, Commons-Sandbox-463.patch
>
>
> In [1] Benedikt Ritter mentioned the lag of BU1's property path for BU2.
> The attached patch contains an implementation of a PropertyInterpreter - 
> following the GOF Interpreter Pattern - which is able to interpret 
> simple/index/mapped/nested properties and any combination of it. The result 
> is a BeanAccessor. The idea is to use the PropertyInterpreter inside of a 
> BeanAccessor implementation.
> The patch also contains a corresponding test case.
> Example:
> on( anyBean ).set( "contact[15].address(home).street" ).with( "Example Street 
> 1000" );
> [1] http://markmail.org/message/pv2qpr7em4ftnulj



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to