Interface LinkManager


@ConsumerType public interface LinkManager
This interface offers a flexible way, based on the builder pattern, to compute links. This is a Sling model that can be injected into other models using the @Self annotation. It can be adapted from a SlingHttpServletRequest. It can be used as follows:
     Link link = linkManager.get(page).build();
     Link link = linkManager.get(page)
          .withLinkTarget(...)
          .withLinkAttribute(...)
          .build();
 
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull LinkBuilder
    get(@NotNull Asset asset)
    Returns a link builder where the link points to an asset.
    @NotNull LinkBuilder
    get(@NotNull Page page)
    Returns a link builder where the link points to a page.
    @NotNull LinkBuilder
    get(@NotNull String url)
    Returns a link builder where the link points to an URL.
    @NotNull LinkBuilder
    get(@NotNull Resource resource)
    Returns a link builder where the link is defined by the resource properties.
  • Method Details

    • get

      @NotNull @NotNull LinkBuilder get(@NotNull @NotNull Resource resource)
      Returns a link builder where the link is defined by the resource properties.
      Parameters:
      resource - Resource to read the link properties from.
      Returns:
      LinkBuilder
    • get

      @NotNull @NotNull LinkBuilder get(@NotNull @NotNull Page page)
      Returns a link builder where the link points to a page.
      Parameters:
      page - Target page of the link.
      Returns:
      LinkBuilder
    • get

      @NotNull @NotNull LinkBuilder get(@NotNull @NotNull Asset asset)
      Returns a link builder where the link points to an asset.
      Parameters:
      asset - Target asset of the link.
      Returns:
      LinkBuilder
    • get

      @NotNull @NotNull LinkBuilder get(@NotNull @NotNull String url)
      Returns a link builder where the link points to an URL.
      Parameters:
      url - URL string of the link.
      Returns:
      LinkBuilder