Class LinkType

java.lang.Object
io.wcm.handler.link.spi.LinkType
Direct Known Subclasses:
ExternalLinkType, InternalCrossContextLinkType, InternalLinkType, InvalidLinkType, MediaLinkType

@ConsumerType public abstract class LinkType extends Object
Defines a link type supported by LinkHandler.

This interface has to be implemented by a Sling Model class. The adaptables should be SlingHttpServletRequest and Resource.

  • Constructor Details

    • LinkType

      public LinkType()
  • Method Details

    • getId

      @NotNull public abstract @NotNull String getId()
      Get link type ID.
      Returns:
      Link type ID (is stored as identifier in repository)
    • getLabel

      @NotNull public @NotNull String getLabel()
      Get link type label.
      Returns:
      Link type label (displayed in link dialogs)
    • getPrimaryLinkRefProperty

      @Nullable public abstract @Nullable String getPrimaryLinkRefProperty()
      Get primary link reference property.
      Returns:
      Name of the property in which the primary link reference is stored
    • accepts

      public boolean accepts(@NotNull @NotNull LinkRequest linkRequest)
      Checks whether a link reference can be handled by this link type
      Parameters:
      linkRequest - Link reference
      Returns:
      true if this link type can handle the given link reference
    • accepts

      public abstract boolean accepts(@NotNull @NotNull String linkRef)
      Checks whether a link reference string can be handled by this link type
      Parameters:
      linkRef - Link reference string
      Returns:
      true if this link type can handle the given link reference
    • resolveLink

      @NotNull public abstract @NotNull Link resolveLink(@NotNull @NotNull Link link)
      Resolves a link
      Parameters:
      link - Link metadata
      Returns:
      Resolved link metadata. Never null.
    • getEditComponentResourceType

      @Nullable public @Nullable String getEditComponentResourceType()
      Granite UI component resource type to be used for editing this link type's properties in edit dialog.
      Returns:
      Granite UI component resource type or null, if none is available
    • hasRichTextPlugin

      public boolean hasRichTextPlugin()
      Returns true if a RTE plugin is available for this link type. If not, it is not possible to select this link type in the rich text editor.
      Returns:
      true if a RTE plugin is available.