Annotation Type RouteParam


@Retention(CLASS) @Target(PARAMETER) public @interface RouteParam

Binds a constructor or static-factory parameter to a path variable or query parameter from an incoming deep link.

Used together with Route. The build-time route processor inspects each annotated parameter and generates dispatch code that pulls the value out of the matched URL before invoking the constructor or factory.

@Route("/users/:id")
public class ProfileForm extends Form {
    public ProfileForm(@RouteParam("id") String id) { ... }
}

@Route("/search")
public static Form search(@RouteParam("q") String query,
                          @RouteParam(value = "page", required = false) String page) { ... }

The value is matched first against named path variables (:name) and then against query-string keys. The annotation is required on every parameter the framework should bind; unannotated parameters are an error at build time.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of the path variable or query parameter to bind.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    When true (the default) the build fails if the deep link cannot supply a value.
  • Element Details

    • value

      String value
      The name of the path variable or query parameter to bind. Required.
    • required

      boolean required
      When true (the default) the build fails if the deep link cannot supply a value. When false a missing value is passed in as null.
      Default:
      true