Flow: Feature Request: HasUrlParameter Support of custom parameter types

Created on 12 Oct 2018  路  4Comments  路  Source: vaadin/flow

Currently HasUrlParameter only supports:

https://github.com/vaadin/flow/blob/40a89b9998c35073db06f4a1073bb56b84835027/flow-server/src/main/java/com/vaadin/flow/router/ParameterDeserializer.java#L40-L43

It would be lovely to support more types, for example UUID or custom types.

Example: We have most of our IDs wrapped in a container class / id class (UserId and so) - it would be awesome to use this types directly and register them with flow.

Ideas to do that:

  • Using JsonSerializable
  • Using ServiceRegistry
  • Moving Code from ParameterDeserializer to a default implementation of HasUrlParameter and let the developer overwrite it. (default T convert(String urlParameter){...})
  • using the third option and Result as return to allow success and error case of parameter transformation

Edit: Used wrong Interface..

enhancement feedback routing

Most helpful comment

"advanced" Router in the next LTS or so :)

On my list of things to improve. V13 is quite tight but V14 is very plausible target for this.

All 4 comments

Hey @knoobie,

There is an add-on that might help you out: https://vaadin.com/directory/component/url-parameter-mapping

It doesn't have all the features you're asking for, but maybe it's a good start for your project.

Thanks, @gilberto-torrezan! That looks really promising.

Upvoted the issues linked in the add-on as well - would love to see the "advanced" Router in the next LTS or so :)

"advanced" Router in the next LTS or so :)

On my list of things to improve. V13 is quite tight but V14 is very plausible target for this.

This should be, at least partially, implemented together with https://github.com/vaadin/flow/issues/8048

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manolo picture manolo  路  3Comments

marcushellberg picture marcushellberg  路  4Comments

pleku picture pleku  路  4Comments

anezthes picture anezthes  路  4Comments

joheriks picture joheriks  路  4Comments