Interface Link<T>


  • @ConsumerType
    public interface Link<T>
    Describes a link target.
    Since:
    com.adobe.cq.wcm.core.components.commons.link 1.0.0
    • Field Detail

      • PN_LINK_URL

        static final String PN_LINK_URL
        Default property name for storing link URL. All new model implementation should use this name, some of the existing models use other names to store the link URL.
        See Also:
        Constant Field Values
      • PN_LINK_ACCESSIBILITY_LABEL

        static final String PN_LINK_ACCESSIBILITY_LABEL
        Property name for storing link accessibility label.
        See Also:
        Constant Field Values
      • PN_LINK_TITLE_ATTRIBUTE

        static final String PN_LINK_TITLE_ATTRIBUTE
        Property name for storing link title attribute.
        See Also:
        Constant Field Values
    • Method Detail

      • isValid

        default boolean isValid()
        Check if the link defined for the component is valid.
        Returns:
        true if component has a valid link defined
        Since:
        com.adobe.cq.wcm.core.components.commons.link 1.0.0
      • getURL

        @Nullable
        default @Nullable String getURL()
        The link URL, supports context path and escaping.
        Returns:
        Link URL or null if link is invalid
      • getMappedURL

        @Nullable
        default @Nullable String getMappedURL()
        The mapped URL, which supports mapping and vanity path. This usually is resource resolver mapping.
        Returns:
        Mapped link URL or null if link is invalid or no processing can be done
      • getExternalizedURL

        @Nullable
        default @Nullable String getExternalizedURL()
        The externalized URL which also contains the scheme and host information. This is usually created with a Externalizer service
        Returns:
        Full link URL or null if link is invalid or can't be externalized.
      • getHtmlAttributes

        @NotNull
        default @NotNull Map<String,​String> getHtmlAttributes()
        Map with Attributes for HTML Anchor tag for this link. This usually also contains the Link URL as href attribute, but may contain additional attributes like target and others.
        Returns:
        Map with HTML-specific anchor attributes, or an empty map if link is invalid
        Since:
        com.adobe.cq.wcm.core.components.commons.link 1.0.0
      • getReference

        @Nullable
        default T getReference()
        Returns the referenced WCM/DAM object.
        Returns:
        Target page or null
        Since:
        com.adobe.cq.wcm.core.components.commons.link 1.0.0