Or maybe generate those statics with a @Deprecated annotation to assist with 
migration to 3.2... 

On Aug 8, 2012, at 8:34 PM, Andrus Adamchik wrote:

> I am now experimenting with the new class generation too. Since Property is 
> simply a singleton wrapper of a String name, it is pretty lightweight IMO. 
> 
> But now I am wondering whether we still need String constants for property 
> names? My main use of those was always when building qualifiers. Now this 
> will be handled via Properties. Besides you can do MY_PROP.getName().
> 
> So do we need this extra redundancy in declarations, making the class less 
> readable? Or should we just keep the Property kind?
> 
> Andrus 
> 
> 
> 
> 
> On Aug 3, 2012, at 4:57 AM, Michael Gentry wrote:
>> I'm a bit delayed and just saw this ...
>> 
>> I'm curious how much extra overhead this will add to each Cayenne
>> class?  Probably not a huge issue since it is declared statically, but
>> I'm still curious.
>> 
>> Thanks,
>> 
>> mrg
>> 
>> 
>> On Wed, Jul 11, 2012 at 3:04 AM, Andrus Adamchik <and...@objectstyle.org> 
>> wrote:
>>> +1. I saw it used on one project and it was a nice concept.
>>> 
>>> Andrus
>>> 
>>> On Jul 11, 2012, at 7:30 AM, John Huss (JIRA) wrote:
>>> 
>>>> John Huss created CAY-1724:
>>>> ------------------------------
>>>> 
>>>>          Summary: Add 'Property' class for easier and better Expression 
>>>> creation
>>>>              Key: CAY-1724
>>>>              URL: https://issues.apache.org/jira/browse/CAY-1724
>>>>          Project: Cayenne
>>>>       Issue Type: Improvement
>>>>       Components: Core Library
>>>> Affects Versions: 3.2M1
>>>>         Reporter: John Huss
>>>>         Priority: Minor
>>>>      Attachments: Property.java
>>>> 
>>>> Project Wonder (WebObjects) has a class which is basically just a wrapper 
>>>> around an attribute or relationship name that gives you a way to create 
>>>> Expressions in type-safe manner and with minimal effort.  Also sort 
>>>> orderings can be easily generated.  In Wonder, these "property" objects 
>>>> are part of the entity template so they are generated automatically.
>>>> 
>>>> So for example:
>>>> 
>>>> public class _Artist extends CayenneDataObject {
>>>> public static final Property<String> NAME = new 
>>>> Property<String>(NAME_PROPERTY);
>>>> ...
>>>> }
>>>> 
>>>> Then client code can do things like:
>>>> 
>>>> new SelectQuery(Artist.class, NAME.eq("Pablo").andExp(AGE.gt(40)), 
>>>> AGE.descs());
>>>> 
>>>> This would select all artists with name equal to Pablo and age greater 
>>>> than 40 and order them in descending age order.
>>>> 
>>>> This concept has been proven to work incredibly well with WebObjects.  
>>>> It's almost as readable as using plain strings but has complete 
>>>> compile-time checking for the property name and the type of the objects it 
>>>> is compared with.
>>>> 
>>>> A complete implementation is attached.  It's very simple since 
>>>> ExpressionFactory does the work.  If this is accepted, it would make sense 
>>>> to modify the built-in entity templates to generate Property constants for 
>>>> all of the properties.
>>>> 
>>>> --
>>>> This message is automatically generated by JIRA.
>>>> If you think it was sent incorrectly, please contact your JIRA 
>>>> administrators: 
>>>> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
>>>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>>> 
>>>> 
>>>> 
>>> 
>> 
> 
> 

Reply via email to