|
From: Jan H. <jh...@sc...> - 2007-08-08 14:35:37
|
Hi all,
I'm currently looking at a way to provide class based formModels. Well
actually it boils down to a different implementation of
MutablePropertyAccessStrategy called ClassPropertyAccessStrategy (CPAS).
It all kinda starts to work, but there are a few things that bother me:
- the current implementation (BeanPropertyAccessStrategy - BPAS) is
using the BeanWrapperImpl behind the scenes. This implies that if
there's a property method with the incorrect visibility, it will be
'fixed' to provide access. Do we need the same functionality here? I
personally don't think so.
- the BPAS is based on beans and thus can inspect collections/maps etc.
The CPAS cannot look into these and currently doesn't support them. Any
comments on this? Should we provide this and how? Geoffrey already gave
a remark about this: we could use annotations to provide information
about the element type and then go on. WDYT?
- I provided both options BPAS and CPAS in order not to break anything.
This leads to changes in
FormModelHelper/AbstractFormModel/DefaultFormModel. Should we continue
with both of them or evaluate both and remove one from the mentioned
classes? The 'removed' can always be used when with the specific
constructor on DefaultFormModel which takes a
MutablePropertyAccessStrategy.
- I want to provide some feature to allow write access when
possible/needed. I'll explain with an example:
interface Person{
String getName();
}
class Admin implements Person {
String getName()...
}
class BadPerson implements Person{
String getName()...
void setName(String)...
}
Now creating a formModel based on Person will only provide you with read
access. Which can be ok for most cases. But when I want write access for
BadPerson, I don't want to create a separate formModel. So I want some
flexibility to state that, when possible, the property name may be
writeable. It would be nice to be able to define a number of properties
that may be writable if the current backing bean allows it. So the class
provided to create the formModel will define the properties and their
getters as a minimum together with the setters of those that are always
writable. If specified, a bean that provides a setter for one of these
properties might enable write access.
I think I can do this by providing some backingBean specific logic in
the CPAS. But I would like to hear your comments on this first.
Kind Regards,
Jan
**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
|