@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.
Methods
public abstract String value() | The name of the path variable or query parameter to bind. |
public abstract boolean required() default true | When true (the default) the build fails if the deep link cannot supply a value. |
Method details
value
public abstract String value()The name of the path variable or query parameter to bind. Required.
required
public abstract boolean required() default trueWhen true (the default) the build fails if the deep link cannot supply a
value. When false a missing value is passed in as null.