Hi Michael,

thanks for an honest attempt to convince me. Hard sell, though. :)

I use a lot of 3rd party libraries and I've only hit one time where using the 
bean spec was necessary — JasperReports. That was easily fixed by providing 
*BeanInfo classes, in accordance with the Bean spec. But Cayenne doesn't really 
follow the Java Bean Spec, it just hardcodes "is", "get" and "set".

As for the Eclipse thing… Well. A standard DataObject already has five methods 
prefixed with "get" so that list is questionable. And I don't miss this 
functionality.

I think it's important to note that the change I'm proposing would not affect 
those who choose to add the prefix. It just accommodates those of us who choose 
not to, thus expanding the audience of the framework.

Cheers,
- hugi



> On 26 Sep 2017, at 12:01, Michael Gentry <blackn...@gmail.com> wrote:
> 
> Hi Hugi,
> 
> Let me try to sell you on the "get" prefix.  :-)
> 
> (I did a lot of WebObjects/EOF in the past, in Objective-C and Java, so I
> understand the reluctance.)
> 
> * The "get" prefix is part of the JavaBeans standard/contract.  With the
> exception of "is" for booleans (with a little "b").
> 
> * There are tons of Java frameworks out there that expect and utilize the
> JavaBeans contract, so it is great for folding external frameworks into
> your code.  Or folding Cayenne into other frameworks, such as Tapestry.  I
> can specify Cayenne object/relationship paths in Tapestry (and other
> frameworks) such as
> t:value="currentItem.resourceSummary.grossCost.costs.continuingFootnote"
> (real example).  Since Tapestry expects the JavaBeans contract and Cayenne
> provides it, this works flawlessly.
> 
> * In Eclipse (and others, I'm sure) I can do anObject.get[pause or
> control-space] and see all the getters associated with that object.
> Without the get prefix, they are spread out a-z and therefore you can't get
> as concise a list.
> 
> mrg
> 
> 
> On Tue, Sep 26, 2017 at 7:02 AM, Hugi Thordarson <h...@karlmenn.is> wrote:
> 
>> Hi all
>> 
>> Touching on an old subject that has now become more important with
>> field-based Data Objects.
>> 
>> All of my DataObjects use accessor methods without the "get"-prefix. This
>> was fine with Map Based data objects (where a MapAccessor would get
>> property values by name), but now that my objects are field based, along
>> comes BeanAccessor which is hardcoded to have every getter prefixed.
>> 
>> I propose that BeanAccessor be modified to allow accessor methods without
>> the "get"-prefix. Methods with "get" would get precedence, but if no method
>> with a "get"-prefix exists, check for the existence of a method with only
>> the property name.
>> 
>> Although it's a minimal change in code, I realise it comes with a bit of
>> potential baggage WRT testing. But this is not just to scratch a personal
>> itch; once Cayenne 4.0 is out I want to start a large scale introduction of
>> Cayenne to the EOF world where the get prefix is generally not liked and
>> this change would have a big appeal. Besides, I'm not a big fan of the
>> get-prefix myself, I find it a bit redundant :).
>> 
>> An alternative would be to adhere to the Bean standard, and make
>> BeanAccessor read bean meta information (usually specified in *BeanInfo
>> classes) and get names of getter/setter methods from there. But that would
>> be a much larger change than just checking for a method with propertyName
>> if the getPropertyName method doesn't exist.
>> 
>> What do you think?
>> 
>> Cheers,
>> - hugi

Reply via email to