In "Wicket in Action" it's mentioned briefly how one could use a
SimpleAttributeModifier to limit the text length of an input, by binding to
a JPA @Column annotation and its length attribute. This sounds nice DRY to
me (albeit perhaps a bit expensive?!) so I gave it a try:

    protected String getColumnLength(Class entityName, String fieldName){
        try {
            Field field = entityName.getDeclaredField(fieldName);
            field.setAccessible(true);
            return
String.valueOf(field.getAnnotation(Column.class).length());
        } catch (Exception ex) {
            return "";
        }
    }

Which got me thinking (after spending an hour figuring out I had to use
setAccessible) if there's an open FAQ/wiki for these kind of things? I have
not been able to find any except the locked down official confluence. Google
is nice, but as a newbie it would be nice to have a central place with lots
of micro-examples/snippets to get you going.

/Casper 
-- 
View this message in context: 
http://www.nabble.com/Open-FAQ-wiki-somewhere--tp20607065p20607065.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]

Reply via email to