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 Summary
Fields Modifier and Type Field Description static StringPN_LINK_ACCESSIBILITY_LABELDeprecated.static StringPN_LINK_TARGETProperty name for storing link target.static StringPN_LINK_TITLE_ATTRIBUTEDeprecated.static StringPN_LINK_URLDefault property name for storing link URL.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default @Nullable StringgetExternalizedURL()The externalized URL which also contains the scheme and host information.default @NotNull Map<String,String>getHtmlAttributes()Returns a Map with attributes for HTML anchor tag for this link.default @Nullable StringgetMappedURL()The mapped URL, which supports mapping and vanity path.default TgetReference()Returns the referenced WCM/DAM object.default @Nullable StringgetURL()The link URL, supports context path and escaping.default booleanisValid()Checks if the link defined for the component is valid.
-
-
-
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_TARGET
static final String PN_LINK_TARGET
Property name for storing link target.- See Also:
- Constant Field Values
-
PN_LINK_ACCESSIBILITY_LABEL
@Deprecated static final 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 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:
trueif 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
nullif 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
nullif 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 aExternalizerservice- Returns:
- Full link URL or
nullif link is invalid or can't be externalized.
-
getHtmlAttributes
@NotNull default @NotNull Map<String,String> getHtmlAttributes()
Returns a Map with attributes for HTML anchor tag for this link. This usually also contains the Link URL ashrefattribute, but may contain additional attributes liketargetand others.- Returns:
Mapwith 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
-
-