public final class ComponentUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ID_SEPARATOR
Name of the separator character used between prefix and hash when generating an ID, e.g.
|
static String |
NN_SLING_CONFIGS
Name of the node holding the context aware configurations below /conf/{site-name};
|
Modifier and Type | Method and Description |
---|---|
static @NotNull String |
generateId(@NotNull String prefix,
@NotNull String path)
Returns an ID based on the prefix, the ID_SEPARATOR and a hash of the path, e.g.
|
static @NotNull String |
getId(@NotNull Resource resource,
@Nullable com.day.cq.wcm.api.Page currentPage,
@Nullable com.day.cq.wcm.api.components.ComponentContext componentContext)
Get the ID property value if set (using
getPropertyId(Resource) ,
otherwise generate a new ID (using generateId(Resource, Page, ComponentContext) . |
static boolean |
isDataLayerEnabled(@NotNull Resource resource)
Check if data layer is enabled.
|
public static final String NN_SLING_CONFIGS
public static final String ID_SEPARATOR
public static boolean isDataLayerEnabled(@NotNull @NotNull Resource resource)
resource
- The resource to check.@NotNull public static @NotNull String getId(@NotNull @NotNull Resource resource, @Nullable @Nullable com.day.cq.wcm.api.Page currentPage, @Nullable @Nullable com.day.cq.wcm.api.components.ComponentContext componentContext)
getPropertyId(Resource)
,
otherwise generate a new ID (using generateId(Resource, Page, ComponentContext)
.resource
- The resource for which to get or generate an ID.currentPage
- The current request page.componentContext
- The current component context.@NotNull public static @NotNull String generateId(@NotNull @NotNull String prefix, @NotNull @NotNull String path)
prefix
- the prefix for the IDpath
- the resource pathCopyright © 2021. All rights reserved.