Hi all!

With 5.0 under development, I’d like to re-awaken an old proposal.

When Cayenne generates classes, you’ll by default get JavaBean style prefixes 
for attribute/relationship method names (“get” and “is”). I've never used those 
and really don't want class generation to affect my method names, so I use my 
own superclass template that does not include those prefixes and patch in my 
own “BeanAccessor” (which is used by Cayenne to invoke class methods) that 
assumes the prefixes are not present.

Since I finally have time to do some Cayenne advocacy, I’m finding it feels 
hacky to instruct folks to drop in a patch if they don’t want the method name 
prefixes — so I’d like to propose that allowing classes to have non-prefixed 
method names be made an option in the Cayenne core.

I’d submit a pull request, but I don’t think I’m the best to propose how to go 
about this. I change the behaviour myself by invoking 
PropertyUtils.installAccessorFactory() with my own implementation ( 
https://gist.github.com/hugithordarson/0367e4e9672df95559d331f072597662 ) (that 
has to be in the package it is, since it relies on package protected 
functionality from Cayenne) but I guess a more friendly way (if not a 
configuration option) would be to make the BeanAccessor injectable.

I don't think I’ll propose adding non-prefixed templates in the core as well — 
adding one's own class generation template to a project feels much more 
“normal” than dropping in a “hack class” to make things work. But just having 
the functionality of NonPrefixedBeanAccessor available in core would be a 
definite improvement.

Furthermore, Carthago delenda something something :D

Cheers,
- hugi

Reply via email to