Interface VeneeredResource
-
- All Superinterfaces:
Accessible
,Adaptable
,Inheritable
,Linkable
,Traversable<VeneeredResource>
- All Known Implementing Classes:
AbstractComponent
public interface VeneeredResource extends Linkable, Accessible, Inheritable, Traversable<VeneeredResource>, Adaptable
Represents a veneered "component" resource in the JCR, typically an unstructured resource in the hierarchy of an AEM page.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<VeneeredPage>
getContainingPage()
Get the page containing this resource.String
getId()
Get the unique ID for this resource based on the path.int
getIndex()
Get the index of this resource in relation to sibling resources.int
getIndex(String resourceType)
Get the index of this resource in relation to sibling resources, ignoring resource types that do not match the specified value.VeneeredResource
getParent()
Get the parent of this resource.Resource
getResource()
Get the underlying resource for this instance.Optional<VeneeredResource>
getResource(String relativePath)
Get the veneered resource for the resource at the given path relative to the current resource.ResourceResolver
getResourceResolver()
Get the Resource Resolver for the underlying Sling resource.List<VeneeredResource>
getResources()
Get a list of child resources for the current resource.List<VeneeredResource>
getResources(String relativePath)
Get a list of child resources for the resource at the given path relative to this resource.List<VeneeredResource>
getResources(String relativePath, String resourceType)
Get a list of child resources for the resource at the given path relative to this resource, returning only the resources that have the specified resource type.List<VeneeredResource>
getResources(String relativePath, Predicate<VeneeredResource> predicate)
Get a list of child resources for the resource at the given path relative to this resource, returning only the resources that meet the predicate criteria.List<VeneeredResource>
getResources(Predicate<VeneeredResource> predicate)
Get a predicate-filtered list of child resources for the current resource.String
getResourceSuperType()
Get the underlying Sling resource super type.String
getResourceType()
Get the underlying Sling resource type.-
Methods inherited from interface org.cid15.aem.veneer.api.Accessible
get, get, getAsHref, getAsLink, getAsLinkBuilder, getAsList, getAsPage, getAsPageList, getAsResource, getAsResourceList, getAsType, getAsTypeList, getImageReference, getImageReference, getImageReference, getImageRendition, getImageRendition, getProperties, getTags, getTags, isHasImage, isHasImage
-
Methods inherited from interface org.cid15.aem.veneer.api.Inheritable
getAsHrefInherited, getAsLinkBuilderInherited, getAsLinkInherited, getAsListInherited, getAsPageInherited, getAsPageListInherited, getAsResourceInherited, getAsResourceListInherited, getAsTypeInherited, getAsTypeListInherited, getImageReferenceInherited, getImageReferenceInherited, getImageReferenceInherited, getInherited, getInherited, getResourceInherited, getResourcesInherited, getResourcesInherited, getResourcesInherited, getResourcesInherited, getTagsInherited, getTagsInherited
-
Methods inherited from interface org.cid15.aem.veneer.api.Linkable
getHref, getLink, getLinkBuilder, getName, getPath
-
Methods inherited from interface org.cid15.aem.veneer.api.Traversable
findAncestor, findAncestor, findAncestorWithProperty, findAncestorWithProperty, findAncestorWithPropertyValue, findAncestorWithPropertyValue, findDescendants
-
-
-
-
Method Detail
-
getResource
Resource getResource()
Get the underlying resource for this instance.- Returns:
- current resource
-
getResourceResolver
ResourceResolver getResourceResolver()
Get the Resource Resolver for the underlying Sling resource.- Returns:
- resource resolver
-
getResourceType
String getResourceType()
Get the underlying Sling resource type.- Returns:
- resource type
-
getResourceSuperType
String getResourceSuperType()
Get the underlying Sling resource super type.- Returns:
- resource super type
-
getId
String getId()
Get the unique ID for this resource based on the path. If this resource is the descendant of a page, the page path will be removed from the identifier, since the relative path of a veneered resource is always unique for a page.- Returns:
- unique ID
-
getIndex
int getIndex()
Get the index of this resource in relation to sibling resources.- Returns:
- index in sibling resources or -1 if resource is null or has null parent resource
-
getIndex
int getIndex(String resourceType)
Get the index of this resource in relation to sibling resources, ignoring resource types that do not match the specified value.- Parameters:
resourceType
- sling:resourceType to filter on- Returns:
- index in sibling resources or -1 if resource is null or has null parent resource
-
getResource
Optional<VeneeredResource> getResource(String relativePath)
Get the veneered resource for the resource at the given path relative to the current resource.- Parameters:
relativePath
- relative path to component- Returns:
Optional
resource for component
-
getResources
List<VeneeredResource> getResources()
Get a list of child resources for the current resource.- Returns:
- list of veneered resources or empty list if none exist
-
getResources
List<VeneeredResource> getResources(Predicate<VeneeredResource> predicate)
Get a predicate-filtered list of child resources for the current resource.- Parameters:
predicate
- predicate used to filter resources- Returns:
- list of veneered resources that meet the predicate criteria or empty list if none exist
-
getResources
List<VeneeredResource> getResources(String relativePath)
Get a list of child resources for the resource at the given path relative to this resource.- Parameters:
relativePath
- relative path to parent of desired resources- Returns:
- list of veneered resources below the specified relative path or empty list if none exist
-
getResources
List<VeneeredResource> getResources(String relativePath, String resourceType)
Get a list of child resources for the resource at the given path relative to this resource, returning only the resources that have the specified resource type.- Parameters:
relativePath
- relative path to parent of desired resourcesresourceType
- sling:resourceType of resources to get from parent resource- Returns:
- list of veneered resources matching the given resource type below the specified relative path or empty list if none exist
-
getResources
List<VeneeredResource> getResources(String relativePath, Predicate<VeneeredResource> predicate)
Get a list of child resources for the resource at the given path relative to this resource, returning only the resources that meet the predicate criteria.- Parameters:
relativePath
- relative path to parent of desired resourcespredicate
- predicate used to filter resources- Returns:
- list of veneered resources that meet the predicate criteria below the specified relative path or empty list if none exist
-
getParent
VeneeredResource getParent()
Get the parent of this resource.- Returns:
- parent veneered resource or absent optional if resource has no parent
-
getContainingPage
Optional<VeneeredPage> getContainingPage()
Get the page containing this resource.- Returns:
- optional containing page
-
-