I LOLed at this:

"Unfortunately, most of us are stuck in Java world where proper functions are 
still considered science fiction like flying cars and World Peace."

----- Original Message -----
From: "Carl-Eric Menzel" <cmen...@wicketbuch.de>
To: users@wicket.apache.org
Sent: Thursday, 21 July, 2011 7:45:02 PM
Subject: A safer way to build PropertyModels

After seeing the LambdaJ-based model idea at
https://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-LambdaJ
I thought I'd try and implement something like that in a ready-to-use
fashion, and simplify it a little.

The result is here:
https://github.com/duesenklipper/wicket-safemodel

This is a way to refactor-safely and type-safely build models, without
relying on brittle string literals:

  SomeBean myBean = ...
  IModel<String> childNameModel =
  model(from(myBean).getChild().getName());

No cast, no string literal, only getters. It works with regular
JavaBeans, Lists, and with Maps (string keys only though).

Instead of requiring a compile-time step this does some proxying in the
background to construct a property expression.

Anybody interested please give it a try and let me know of any issues.

Note: If you feel comfortable with configuring an annotation
processor in your Maven build as well as your IDE build, go ahead and
try Igor's metagen [https://github.com/42Lines/metagen]. That way you
don't have any runtime magic.

Use SafeModel if you don't want an additional compile step and do want
(very slightly) less keyboard typing.

Carl-Eric
www.wicketbuch.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to