Package org.apache.sling.query
Class SlingQuery
- java.lang.Object
-
- org.apache.sling.query.AbstractQuery<org.apache.sling.api.resource.Resource,SlingQuery>
-
- org.apache.sling.query.SlingQuery
-
- All Implemented Interfaces:
Iterable<org.apache.sling.api.resource.Resource>
@ProviderType public class SlingQuery extends AbstractQuery<org.apache.sling.api.resource.Resource,SlingQuery>
SlingQuery is a Sling resource tree traversal tool inspired by the jQuery.
-
-
Field Summary
-
Fields inherited from class org.apache.sling.query.AbstractQuery
functions
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SlingQuery
$(org.apache.sling.api.resource.Resource... resources)
static SlingQuery
$(org.apache.sling.api.resource.ResourceResolver resolver)
protected SlingQuery
clone(AbstractQuery<org.apache.sling.api.resource.Resource,SlingQuery> original, SearchStrategy strategy)
<E> Iterable<E>
map(Class<? extends E> clazz)
Transform the whole collection to a newIterable
object, invokingAdaptable.adaptTo(Class)
method on each Resource.String
toString()
-
Methods inherited from class org.apache.sling.query.AbstractQuery
add, add, asList, children, children, children, children, closest, closest, closest, eq, filter, filter, filter, find, find, find, find, first, has, has, has, iterator, last, next, next, next, next, nextAll, nextAll, nextAll, nextAll, nextUntil, nextUntil, nextUntil, not, not, not, parent, parents, parents, parents, parents, parentsUntil, parentsUntil, parentsUntil, prev, prev, prev, prev, prevAll, prevAll, prevAll, prevAll, prevUntil, prevUntil, prevUntil, searchStrategy, siblings, siblings, siblings, siblings, slice, slice, stream, unique
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
$
public static SlingQuery $(org.apache.sling.api.resource.Resource... resources)
-
$
public static SlingQuery $(org.apache.sling.api.resource.ResourceResolver resolver)
-
map
public <E> Iterable<E> map(Class<? extends E> clazz)
Transform the whole collection to a newIterable
object, invokingAdaptable.adaptTo(Class)
method on each Resource. If some Resource can't be adapted to the class (eg.adaptTo()
returnsnull
), it will be skipped.- Type Parameters:
E
- type of the clazz- Parameters:
clazz
- Class used to adapt the Resources- Returns:
- new iterable containing succesfully adapted Resources
-
clone
protected SlingQuery clone(AbstractQuery<org.apache.sling.api.resource.Resource,SlingQuery> original, SearchStrategy strategy)
- Specified by:
clone
in classAbstractQuery<org.apache.sling.api.resource.Resource,SlingQuery>
-
toString
public String toString()
- Overrides:
toString
in classAbstractQuery<org.apache.sling.api.resource.Resource,SlingQuery>
-
-