Package org.cid15.aem.veneer.api
Interface Traversable<T>
-
- Type Parameters:
T
- type of traversable resource
- All Known Subinterfaces:
VeneeredPage
,VeneeredResource
- All Known Implementing Classes:
AbstractComponent
public interface Traversable<T>
Definition for hierarchical JCR resources that can be traversed.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<T>
findAncestor(Predicate<T> predicate)
Find the first ancestor resource that matches the given predicate condition.Optional<T>
findAncestor(Predicate<T> predicate, boolean excludeCurrentResource)
Find the first ancestor resource that matches the given predicate condition.Optional<T>
findAncestorWithProperty(String propertyName)
Find the first ancestor resource containing the given property name.Optional<T>
findAncestorWithProperty(String propertyName, boolean excludeCurrentResource)
Find the first ancestor resource containing the given property name.<V> Optional<T>
findAncestorWithPropertyValue(String propertyName, V propertyValue)
Find the first ancestor resource where the given property name has the specified value.<V> Optional<T>
findAncestorWithPropertyValue(String propertyName, V propertyValue, boolean excludeCurrentResource)
Find the first ancestor resource where the given property name has the specified value.List<T>
findDescendants(Predicate<T> predicate)
Get a list of descendant resources that match the given predicate condition.
-
-
-
Method Detail
-
findAncestor
Optional<T> findAncestor(Predicate<T> predicate)
Find the first ancestor resource that matches the given predicate condition.- Parameters:
predicate
- predicate to match ancestor resources against- Returns:
Optional
resource that matches the predicate condition
-
findAncestor
Optional<T> findAncestor(Predicate<T> predicate, boolean excludeCurrentResource)
Find the first ancestor resource that matches the given predicate condition.- Parameters:
predicate
- predicate to match ancestor resources againstexcludeCurrentResource
- if true, the current resource will be excluded (i.e. even if the current resource matches the predicate criteria, it will not be returned)- Returns:
Optional
resource that matches the predicate condition
-
findAncestorWithProperty
Optional<T> findAncestorWithProperty(String propertyName)
Find the first ancestor resource containing the given property name.- Parameters:
propertyName
- property name to find on ancestor resources- Returns:
Optional
resource that contains the property
-
findAncestorWithProperty
Optional<T> findAncestorWithProperty(String propertyName, boolean excludeCurrentResource)
Find the first ancestor resource containing the given property name.- Parameters:
propertyName
- property name to find on ancestor resourcesexcludeCurrentResource
- if true, the current resource will be excluded (i.e. even if the current resource matches the predicate criteria, it will not be returned)- Returns:
Optional
resource that contains the property
-
findAncestorWithPropertyValue
<V> Optional<T> findAncestorWithPropertyValue(String propertyName, V propertyValue)
Find the first ancestor resource where the given property name has the specified value.- Type Parameters:
V
- type of value- Parameters:
propertyName
- property name to find on ancestor resourcespropertyValue
- value of named property to match- Returns:
Optional
resource that contains the property value
-
findAncestorWithPropertyValue
<V> Optional<T> findAncestorWithPropertyValue(String propertyName, V propertyValue, boolean excludeCurrentResource)
Find the first ancestor resource where the given property name has the specified value.- Type Parameters:
V
- type of value- Parameters:
propertyName
- property name to find on ancestor resourcespropertyValue
- value of named property to matchexcludeCurrentResource
- if true, the current resource will be excluded (i.e. even if the current resource matches the predicate criteria, it will not be returned)- Returns:
Optional
resource that contains the property value
-
findDescendants
List<T> findDescendants(Predicate<T> predicate)
Get a list of descendant resources that match the given predicate condition.- Parameters:
predicate
- predicate to match descendant resources against- Returns:
- list of resources that match the predicate condition or empty list if none exist
-
-