Change in Behaviour with "Read Property" Methods
------------------------------------------------
Key: CAY-1512
URL: https://issues.apache.org/jira/browse/CAY-1512
Project: Cayenne
Issue Type: Improvement
Components: Core Library
Affects Versions: 3.0
Reporter: Andrew Lindesay
Fix For: 3.0.2
There is an issue that a data object (DO) uses the "readProperty()" method in
its accessors such as "getStartTimestamp()"/"getArtist()" etc... The
"readNestedProperty()" does some extra things like using reflection to get at
additional accessors, but "readProperty()" does not. This is an inconsistency.
Simply adding the additional reflection to "readProperty()" is not a good idea
because in the case where an object is not yet related to the model, the
reflection can end up infinite-looping and it is hard to see a logical
condition to stop it.
My suggestion is to add a protected "readPropertyStored()" which will be used
by the accessors such as "getStartTimestamp()"/"getArtist()". This method will
~not~ use reflection, but "readProperty()" will do the additional reflection if
necessary. The "readPropertyStored()" will invoke "readPropertyDirectly()".
In addition, the "extra reflection" would be serviced through two additional
methods on the data object;
readPropertyDerived(..)
For the case of the "readNestedProperty(..)" the use of reflection into an
object which is ~not~ a data object will be serviced through;
readNestedPropertyFromNonDataObject(..)
Together these changes will allow for consistenecy in the 'read property'
behaviour and will also allow third parties to more easily extend Cayenne's
'read property' behaviours in order to support more sophisticated 'ready
property' behaviour.
This is a change in behaviour and generated DAO classes would need to be
modified to use 'readPropertyStored()' instead of 'readProperty()'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.