Interface Link<T>


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

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default @Nullable java.lang.String getExternalizedURL()
      The externalized URL which also contains the scheme and host information.
      default @NotNull java.util.Map<java.lang.String,​java.lang.String> getHtmlAttributes()
      Returns a Map with attributes for HTML anchor tag for this link.
      default @Nullable java.lang.String getMappedURL()
      The mapped URL, which supports mapping and vanity path.
      default T getReference()
      Returns the referenced WCM/DAM object.
      default @Nullable java.lang.String getURL()
      The link URL, supports context path and escaping.
      default boolean isValid()
      Checks if the link defined for the component is valid.
    • Field Detail

      • PN_LINK_URL

        static final java.lang.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_TARGET

        static final java.lang.String PN_LINK_TARGET
        Property name for storing link target.
        See Also:
        Constant Field Values
      • PN_LINK_ACCESSIBILITY_LABEL

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

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

      • isValid

        default boolean isValid()
        Checks 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 java.lang.String getURL()
        The link URL, supports context path and escaping.
        Returns:
        Link URL or null if link is invalid
      • getMappedURL

        @Nullable
        default @Nullable java.lang.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 java.lang.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 java.util.Map<java.lang.String,​java.lang.String> getHtmlAttributes()
        Returns a 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