I don't see how 'B' can have method #bind(IModel)
Correct, I fixed the example to declare B as LazyModel<B>.
I also saw performance tests which verify that LazyModel is at least twice faster than PropertyModel.
Not quite: In my idealized test-case it is at most 2 times *slower* than PropertyModel. This holds when each LazyModel is "used" (i.e. getObject() called) at least ten times, e.g. in an Ajax heavy application where you stay on a single page for a longer time. If each LazyModel is used once only (e.g. on a stateless page) it might get up to 5 times slower than PropertyModel. That proxying comes at a high price, there's no way around it :/. PropertyModel is still the king of performance. Or you have to switch to a preprocessor solution like bindgen-wicket. I'll add this information to the wiki page. Note that LazyModel is approx. twice as fast as safemodel or modelfactory :P. Many thanks for your feedback. Best regards Sven On 02/19/2013 08:48 AM, Martin Grigorov wrote:
Hi Sven, I think it would be useful if you add an explanation to the wiki page how it works. As far as I see from the code it is based on reflection by using Objenesis. I also saw performance tests which verify that LazyModel is at least twice faster than PropertyModel. This information may be used as an advertisement in the Wiki page! Also I think there is an error in this example: private static final IModel<B> B = model(from(A.class).getB()); IModel<A> a = ...; add(new TextField<B>("b", B.bind(a)); I don't see how 'B' can have method #bind(IModel) unless the IModel in the example is some other class, not the one in wicket-core. On Mon, Feb 18, 2013 at 7:30 PM, Sven Meier <[email protected]> wrote:Hi all, I've added a new module to wicketstuff: LazyModel offers lazy evaluation of method invocations. It takes the best from present solutions (safemodel and modelfactory) and improves on reflection to support: * arbitrary parameters * generics * collections * interfaces Two simple examples: IModel<String> model = model(from(a).getB().** getStrings().get("key")); new LazyColumn<A, B>(header, from(A.class).getB()); Read more here: https://github.com/**wicketstuff/core/wiki/**LazyModel<https://github.com/wicketstuff/core/wiki/LazyModel> Have fun Sven ------------------------------**------------------------------**--------- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<[email protected]> For additional commands, e-mail: [email protected]
