Hi,

I found myself repeatedly creating a PageParameters object from some
domain object for BookmarkablePageLink just to have it then "parsed"
back to that same domain object.
Example:

    Release rel { product: AS; version: 7.1.2 }
    =>
    add( new BookmarkablePageLink ( "link", ReleasePage.class, new
PageParameters()
            .add("product", rel.getProduct().getName())
            .add("version", rel.getVersion() ) 
    ) );

So to avoid repeating that all the time, I created (besides a link
component) this in ReleasePage:

    public static PageParameters createPageParameters( Release rel ){
        return new PageParameters()
            .add("product", rel.getProduct().getName())
            .add("version", rel.getVersion() );
    }

And I was thinking - is there some mechanism to automatically create the
params from the domain object, using properties matching against mount()
string?
E.g. like this:

    mountPage("/release/${product.name}/${version}", ReleasePage.class);
    new BookmarkablePageLink ( "link", ReleasePage.class, rel);   //
This would create page params the properties.

Anything like this available? If not, is it doable? It would reduce
quite some boilerplate code.

Thanks,
Ondra


Reply via email to