cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <>
Subject Re: Allowing property getters without a "get" prefix on DataObjects
Date Tue, 26 Sep 2017 12:01:02 GMT
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
(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.


On Tue, Sep 26, 2017 at 7:02 AM, Hugi Thordarson <> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message