@Retention(CLASS) @Target({TYPE, METHOD})

public @interface Route

Binds a Form class – or a static method that returns a Form – to a URL path so the framework can show it in response to a deep link.

@Route is the only annotation an application needs in order to make a form reachable from a Universal Link, an Android App Link, a custom-scheme URL, a push-notification payload, or any other URL the platform delivers to the app. Path variables flow into constructor or method parameters through RouteParam.

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

public class Routes {
    @Route("/home")
    public static Form home() {
        return new HomeForm();
    }

    @Route("/users/:id")
    public static Form profile(@RouteParam("id") String id) {
        return new ProfileForm(id);
    }
}

At build time the Codename One Maven plugin scans the project’s compiled bytecode, validates every @Route (extends Form, accessible constructor or static factory, no duplicate patterns, every parameter bound), then generates an internal dispatch class that the framework wires to the platform’s deep-link plumbing under the hood. There is no reflection at runtime and no router API for the application to call – new MyForm().show() is still the way to navigate inside the app; URL routing only handles links coming from outside.

Path syntax

  • Literal segments/about
  • Named parameters/users/:id, bound via @RouteParam("id")
  • Single-segment wildcard/files/*
  • Catch-all wildcard/files/**

Nested types

annotation Route.RoutesContainer annotation for binding several path patterns to the same target.

Methods

public abstract String value()The path pattern.

Method details

value

public abstract String value()
The path pattern. Always starts with /. Required.