Skip to content

Creating templated links when pointing to controller methods in Kotlin #1186

Open
@Konngitas

Description

@Konngitas

Currently, if we want a templated URI that we do not manually build ourselves, we can do
linkTo(methodOn(UserController::class.java).getUser(null)).withRel("user")

This works fine with Java as we can pass null parameters to any method, but it does not work well in Kotlin, as in Kotlin we have to explicitly make our method's parameters nullable. This creates opportunities for mistakes and undermines the inherent safety of kotlin, making us do null checks just like in java instead of being able to assure that this controller method can not accept nullable parameters.

It would be nice if we had some other way to do this that isnt building the URI manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions