@ProviderType public final class Template extends Object
Modifier and Type | Method and Description |
---|---|
static <E extends Enum<E> & TemplatePathInfo> |
forPage(@NotNull com.day.cq.wcm.api.Page page,
Class<E>... templateEnums)
Lookup template for given page.
|
static TemplatePathInfo |
forPage(@NotNull com.day.cq.wcm.api.Page page,
TemplatePathInfo... templates)
Lookup template for given page.
|
static <E extends Enum<E> & TemplatePathInfo> |
forTemplatePath(@NotNull String templatePath,
Class<E>... templateEnums)
Lookup a template by the given template path.
|
static TemplatePathInfo |
forTemplatePath(@NotNull String templatePath,
TemplatePathInfo... templates)
Lookup a template by the given template path.
|
static @Nullable String |
getResourceTypeFromTemplatePath(@NotNull String templatePath)
Gets the resource type for a given template path.
|
static boolean |
is(@NotNull com.day.cq.wcm.api.Page page,
String... templatePaths)
Checks if the given page uses a specific template.
|
static boolean |
is(@NotNull com.day.cq.wcm.api.Page page,
TemplatePathInfo... templates)
Checks if the given page uses a specific template.
|
@Nullable public static @Nullable String getResourceTypeFromTemplatePath(@NotNull @NotNull String templatePath)
This is based on the assumption that:
/apps/{app_path}/templates/{optional_path}/{template_path}
{app_path}/components/{optional_path}/page/{template_path}
templatePath
- Template pathpublic static boolean is(@NotNull @NotNull com.day.cq.wcm.api.Page page, @NotNull TemplatePathInfo... templates)
page
- AEM pagetemplates
- Template(s)public static boolean is(@NotNull @NotNull com.day.cq.wcm.api.Page page, @NotNull String... templatePaths)
page
- AEM pagetemplatePaths
- Template path(s)public static TemplatePathInfo forTemplatePath(@NotNull @NotNull String templatePath, @NotNull TemplatePathInfo... templates)
templatePath
- Path of templatetemplates
- TemplatesTemplatePathInfo
instance or null for unknown template paths@SafeVarargs public static <E extends Enum<E> & TemplatePathInfo> TemplatePathInfo forTemplatePath(@NotNull @NotNull String templatePath, @NotNull Class<E>... templateEnums)
E
- Template enumtemplatePath
- Path of templatetemplateEnums
- TemplatesTemplatePathInfo
instance or null for unknown template pathspublic static TemplatePathInfo forPage(@NotNull @NotNull com.day.cq.wcm.api.Page page, @NotNull TemplatePathInfo... templates)
page
- Pagetemplates
- TemplatesTemplatePathInfo
instance or null for unknown template paths@SafeVarargs public static <E extends Enum<E> & TemplatePathInfo> TemplatePathInfo forPage(@NotNull @NotNull com.day.cq.wcm.api.Page page, @NotNull Class<E>... templateEnums)
E
- Template enumpage
- PagetemplateEnums
- TemplatesTemplatePathInfo
instance or null for unknown template pathsCopyright © 2014–2019 wcm.io. All rights reserved.