another thing that occurs to me is that perhaps the method would be more generalized we basically made a fill-in for the missing .property feature. we could have a method like Reflection.property(expr) return a property expression string (or a compiled version of it). this makes me think there's a missing reflection package in java in general...
Jonathan Locke wrote: > > like BoundCompoundPropertyModel, but safer. i think this almost might be > too clever as it sacrifices some intuitiveness. also, it's filling in for > a missing java feature. this should really be: > > boundModel.bind(component, firstName.property) > > (where .property, .field and .method are long-missing declarative > reflections like .class) > > it does make me think we could be doing more with CGLIB in general. our > model classes ought to be able to detect model changes better using > proxies, for example. > > > Scott Swank wrote: >> >> One of our more clever developers created a CompoundPropertyModel that >> uses a cglib proxy to strongly bind the mutators to the model. It >> looks like this: >> >> SharedPropertyModel<Customer> model = new >> SharedPropertyModel<Customer>(customer); >> this.setModel(model); >> >> FormComponent firstName = new >> CustomerNameField("firstName").setRequired(true); >> model.bind(firstName).to().getFirstName(); >> add(firstName); >> >> FormComponent lastName = new >> CustomerNameField("lastName").setRequired(true); >> model.bind(lastName).to().getLastName(); >> add(lastName); >> >> FormComponent addr1 = new >> AddressField("address1").setRequired(true); >> model.bind(addr1).to().getAddress().getAddress1(); >> add(addr1); >> >> FormComponent addr2 = new AddressField("address2"); >> model.bind(addr2).to().getAddress().getAddress2(); >> add(addr2); >> >> FormComponent city = new CityField("city"); >> model.bind(city).to().getAddress().getCity(); >> add(city); >> >> We're happy to share if folk like this approach. N.B. that the .to() >> call is for readability rather than out of any necessity. >> >> Cheers, >> Scott >> >> -- >> Scott Swank >> reformed mathematician >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > -- View this message in context: http://www.nabble.com/CompoundModel-based-on-proxies-tp15317807p15325688.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]