I agree with Jeff that an alternative syntax is questionable and likely
unnecessary. The syntax for accessing members of an object should be the
same, regardless if the property is an instance variable or method. Rather,
there should be a flag which enables direct property access which will be
used if no property method exists. If you're concerned about performance,
the probe should record the "best route" so that this check isn't done every
time.

I recommend a new configuration setting be allowed in the global
configuration and (for overriding) on the resultMap:

<resultMap ... directFieldAccessFallback="true">
 <property col="street" name="account.address.street">
</resultMap>

Paul

On 2/9/07, Jeff Butler <[EMAIL PROTECTED]> wrote:

I think this is a good idea.

However, I wonder if it is necessary to add the extra syntax?  Could we be
smart enough to use a getter/setter if one exists, else resort to direct
field access?  Then there would be no need for the extra parenthesis syntax.


Jeff Butler



On 2/9/07, Clinton Begin <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I found a few hours tonight to implement direct-to-field mappings.  I
> don't have any energy left to explain it fully, but it's simple to
> use, so here's the summary.
>
> To implement this, I changed the ClassInfo to accept a new pattern of
> "property" access.  You can now wrap a field names in round brackets
> to distinguish them from properties.  So:
>
> "id" is a property.
> "(id)" is a field.
>
> These can be mixed with properties like:
>
> "account.(address).street"
>
> This last point is important and is the primary reason I didn't use a
> new XML tag -- that would have severely limited the mix-n-match
> ability of the feature (and it would have been harder to implement).
>
> This approach works for reads and writes and for both inline or
> external parameter maps and result maps.
>
> It should be ubiquitous.  Anywhere you used to use property names, you
> can now use (field) names too.
>
> Thoughts?  It's not too late to change the syntax (round brackets) or
> anything else.
>
> I think it's the simplest, most flexible and performant approach.
>
> Cheers,
> Clinton
>


Reply via email to