Class Place

java.lang.Object
org.jboss.elemento.router.Place

public class Place extends Object
Represents a place in an application. A place is identified by a route, an optional title, a custom root element and an optional LoadData.

The route is the full pattern including parameter placeholders (e.g. "/users/:id" or "/configuration/:item?"). The path is the route with optional parameter segments removed — it represents the shortest concrete URL that matches the route. For routes without optional parameters, route() and path() return the same value.

Routes support both required parameters (e.g. ":id") and optional parameters (e.g. ":id?"). Optional parameters must be trailing — they can only appear at the end of the route.

If the route has parameters, the PlaceManager will collect them and pass them to the page when calling Page.elements(Place, Parameter, LoadedData).

If the page has a LoadData, the PlaceManager will call it and pass the loaded data as LoadedData to the page when calling Page.elements(Place, Parameter, LoadedData).

If a title is given, the PlaceManager will change the document title accordingly. If a custom root selector or element is given, the PlaceManager will replace the contents of that element with the Page registered for this place.

  • Method Details

    • place

      public static Place place(String route)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • title

      public Place title(String title)
    • root

      public Place root(String selector)
    • root

      public Place root(By selector)
    • root

      public Place root(HTMLElement element)
    • root

      public Place root(Supplier<HTMLElement> root)
    • loader

      public Place loader(LoadData<?> loader)
    • route

      public String route()
      Returns the full route pattern including parameter placeholders (e.g. "/users/:id" or "/configuration/:path?").
    • path

      public String path()
      Returns the route with optional parameter segments removed. This is the shortest concrete URL that matches the route. For routes without optional parameters, this returns the same value as route().
    • title

      public String title()
      Returns the title, or null if none was set.