Package io.wcm.handler.link.spi
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 java.lang.Object
Defines a link type supported byLinkHandler
.This interface has to be implemented by a Sling Model class. The adaptables should be
SlingHttpServletRequest
andResource
.
-
-
Constructor Summary
Constructors Constructor Description LinkType()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
accepts(@NotNull LinkRequest linkRequest)
Checks whether a link reference can be handled by this link typeabstract boolean
accepts(@NotNull java.lang.String linkRef)
Checks whether a link reference string can be handled by this link type@Nullable java.lang.String
getEditComponentResourceType()
Granite UI component resource type to be used for editing this link type's properties in edit dialog.abstract @NotNull java.lang.String
getId()
@NotNull java.lang.String
getLabel()
abstract @Nullable java.lang.String
getPrimaryLinkRefProperty()
boolean
hasRichTextPlugin()
Returns true if a RTE plugin is available for this link type.abstract @NotNull Link
resolveLink(@NotNull Link link)
Resolves a link
-
-
-
Method Detail
-
getId
@NotNull public abstract @NotNull java.lang.String getId()
- Returns:
- Link type ID (is stored as identifier in repository)
-
getLabel
@NotNull public @NotNull java.lang.String getLabel()
- Returns:
- Link type label (displayed in link dialogs)
-
getPrimaryLinkRefProperty
@Nullable public abstract @Nullable java.lang.String getPrimaryLinkRefProperty()
- 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 java.lang.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 java.lang.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.
-
-