@ProviderType public abstract class AbstractQuery<T,Q extends AbstractQuery<T,Q>> extends Object implements Iterable<T>
Modifier and Type | Field and Description |
---|---|
protected List<Function<?,?>> |
functions |
Modifier | Constructor and Description |
---|---|
protected |
AbstractQuery(AbstractQuery<T,Q> original,
SearchStrategy searchStrategy) |
Modifier and Type | Method and Description |
---|---|
Q |
add(Iterable<T> iterable)
Include resources to the collection.
|
Q |
add(T... resources)
Include resources to the collection.
|
List<T> |
asList()
Transform SlingQuery collection into a lazy list.
|
Q |
children()
Get list of the children for each Resource in the collection.
|
Q |
children(Iterable<T> filter)
Get list of the children for each Resource in the collection.
|
Q |
children(Predicate<T> filter)
Get list of the children for each Resource in the collection.
|
Q |
children(String filter)
Get list of the children for each Resource in the collection.
|
protected abstract Q |
clone(AbstractQuery<T,Q> original,
SearchStrategy strategy) |
Q |
closest(Iterable<T> iterable)
For each Resource in the collection, return the first element matching the selector testing the
Resource itself and traversing up its ancestors.
|
Q |
closest(Predicate<T> predicate)
For each Resource in the collection, return the first element matching the selector testing the
Resource itself and traversing up its ancestors.
|
Q |
closest(String selector)
For each Resource in the collection, return the first element matching the selector testing the
Resource itself and traversing up its ancestors.
|
Q |
eq(int index)
Reduce Resource collection to the one Resource at the given 0-based index.
|
Q |
filter(Iterable<T> iterable)
Filter Resource collection using given iterable.
|
Q |
filter(Predicate<T> predicate)
Filter Resource collection using given predicate object.
|
Q |
filter(String selector)
Filter Resource collection using given selector.
|
Q |
find()
For each Resource in collection use depth-first search to return all its descendants.
|
Q |
find(Iterable<T> iterable)
For each Resource in collection use breadth-first search to return all its descendants.
|
Q |
find(Predicate<T> predicate)
For each Resource in collection use breadth-first search to return all its descendants.
|
Q |
find(String selector)
For each Resource in collection use breadth-first search to return all its descendants.
|
Q |
first()
Filter Resource collection to the first element.
|
Q |
has(Iterable<T> iterable)
Pick such Resources from the collection that have descendant matching the selector.
|
Q |
has(Predicate<T> predicate)
Pick such Resources from the collection that have descendant matching the selector.
|
Q |
has(String selector)
Pick such Resources from the collection that have descendant matching the selector.
|
Iterator<T> |
iterator() |
Q |
last()
Filter Resource collection to the last element.
|
Q |
next()
Return the next sibling for each Resource in the collection.
|
Q |
next(Iterable<T> iterable)
Return the next sibling for each Resource in the collection and filter it by a selector.
|
Q |
next(Predicate<T> predicate)
Return the next sibling for each Resource in the collection and filter it by a selector.
|
Q |
next(String selector)
Return the next sibling for each Resource in the collection and filter it by a selector.
|
Q |
nextAll()
Return all following siblings for each Resource in the collection.
|
Q |
nextAll(Iterable<T> iterable)
Return all following siblings for each Resource in the collection, filtering them by a selector.
|
Q |
nextAll(Predicate<T> predicate)
Return all following siblings for each Resource in the collection, filtering them by a selector.
|
Q |
nextAll(String selector)
Return all following siblings for each Resource in the collection, filtering them by a selector.
|
Q |
nextUntil(Iterable<T> iterable)
Return all following siblings for each Resource in the collection up to, but not including, Resource
matched by a selector.
|
Q |
nextUntil(Predicate<T> predicate)
Return all following siblings for each Resource in the collection up to, but not including, Resource
matched by a selector.
|
Q |
nextUntil(String until)
Return all following siblings for each Resource in the collection up to, but not including, Resource
matched by a selector.
|
Q |
not(Iterable<T> iterable)
Remove elements from the collection.
|
Q |
not(Predicate<T> predicate)
Remove elements from the collection.
|
Q |
not(String selector)
Remove elements from the collection.
|
Q |
parent()
Replace each element in the collection with its parent.
|
Q |
parents()
For each element in the collection find its all ancestor.
|
Q |
parents(Iterable<T> iterable)
For each element in the collection find its all ancestor, filtered by a selector.
|
Q |
parents(Predicate<T> predicate)
For each element in the collection find its all ancestor, filtered by a selector.
|
Q |
parents(String selector)
For each element in the collection find its all ancestor, filtered by a selector.
|
Q |
parentsUntil(Iterable<T> iterable)
For each element in the collection find all of its ancestors until the predicate is met.
|
Q |
parentsUntil(Predicate<T> predicate)
For each element in the collection find all of its ancestors until the predicate is met.
|
Q |
parentsUntil(String until)
For each element in the collection find all of its ancestors until the predicate is met.
|
Q |
prev()
Return the previous sibling for each Resource in the collection.
|
Q |
prev(Iterable<T> iterable)
Return the previous sibling for each Resource in the collection and filter it by a selector.
|
Q |
prev(Predicate<T> predicate)
Return the previous sibling for each Resource in the collection and filter it by a selector.
|
Q |
prev(String selector)
Return the previous sibling for each Resource in the collection and filter it by a selector.
|
Q |
prevAll()
Return all previous siblings for each Resource in the collection.
|
Q |
prevAll(Iterable<T> iterable)
Return all previous siblings for each Resource in the collection, filtering them by a selector.
|
Q |
prevAll(Predicate<T> predicate)
Return all previous siblings for each Resource in the collection, filtering them by a selector.
|
Q |
prevAll(String selector)
Return all previous siblings for each Resource in the collection, filtering them by a selector.
|
Q |
prevUntil(Iterable<T> iterable)
Return all previous siblings for each Resource in the collection up to, but not including, Resource
matched by a selector.
|
Q |
prevUntil(Predicate<T> predicate)
Return all previous siblings for each Resource in the collection up to, but not including, Resource
matched by a selector.
|
Q |
prevUntil(String until)
Return all previous siblings for each Resource in the collection up to, but not including, Resource
matched by a selector.
|
Q |
searchStrategy(SearchStrategy strategy)
Set new search strategy, which will be used in
find() and
has(String) functions. |
Q |
siblings()
Return siblings for the given Ts.
|
Q |
siblings(Iterable<T> iterable)
Return siblings for the given Resources filtered by a selector.
|
Q |
siblings(Predicate<T> predicate)
Return siblings for the given Resources filtered by a selector.
|
Q |
siblings(String selector)
Return siblings for the given Resources filtered by a selector.
|
Q |
slice(int from)
Filter out first
from Resources from the collection. |
Q |
slice(int from,
int to)
Reduce the collection to a subcollection specified by a given range.
|
Stream<T> |
stream() |
String |
toString() |
Q |
unique()
Filter out repeated resources.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected AbstractQuery(AbstractQuery<T,Q> original, SearchStrategy searchStrategy)
public Q add(T... resources)
resources
- Resources to includepublic Q add(Iterable<T> iterable)
iterable
- Resources to includepublic List<T> asList()
public Q children()
public Q children(String filter)
filter
- Children filterpublic Q children(Predicate<T> filter)
filter
- Children filterpublic Q children(Iterable<T> filter)
filter
- Children filterpublic Q closest(String selector)
selector
- Ancestor filterpublic Q closest(Iterable<T> iterable)
iterable
- Ancestor filterpublic Q closest(Predicate<T> predicate)
predicate
- Ancestor filterpublic Q eq(int index)
index
- 0-based indexpublic Q filter(String selector)
selector
- Selectorpublic Q filter(Predicate<T> predicate)
predicate
- Collection filterpublic Q filter(Iterable<T> iterable)
iterable
- Collection filterpublic Q find()
public Q find(String selector)
selector
- descendants filterpublic Q find(Predicate<T> predicate)
predicate
- descendants filterpublic Q find(Iterable<T> iterable)
iterable
- descendants filterpublic Q first()
eq(0)
or slice(0, 0)
.public Q has(String selector)
selector
- Descendant selectorpublic Q has(Predicate<T> predicate)
predicate
- Descendant selectorpublic Q has(Iterable<T> iterable)
iterable
- Descendant selectorpublic Q last()
public Q next()
public Q next(String selector)
selector
- Next sibling filterpublic Q next(Predicate<T> predicate)
predicate
- Next sibling filterpublic Q next(Iterable<T> iterable)
iterable
- Next sibling filterpublic Q nextAll()
public Q nextAll(String selector)
selector
- Following siblings filterpublic Q nextAll(Predicate<T> predicate)
predicate
- Following siblings filterpublic Q nextAll(Iterable<T> iterable)
iterable
- Following siblings filterpublic Q nextUntil(String until)
until
- Selector marking when the operation should stoppublic Q nextUntil(Predicate<T> predicate)
predicate
- Selector marking when the operation should stoppublic Q nextUntil(Iterable<T> iterable)
iterable
- Selector marking when the operation should stoppublic Q not(String selector)
selector
- Selector used to remove Resourcespublic Q not(Predicate<T> predicate)
predicate
- Selector used to remove Resourcespublic Q not(Iterable<T> iterable)
iterable
- Selector used to remove Resourcespublic Q parent()
public Q parents()
public Q parents(String selector)
selector
- Parents filterpublic Q parents(Predicate<T> predicate)
predicate
- Parents filterpublic Q parents(Iterable<T> iterable)
iterable
- Parents filterpublic Q parentsUntil(String until)
until
- Selector marking when the operation should stoppublic Q parentsUntil(Predicate<T> predicate)
predicate
- Selector marking when the operation should stoppublic Q parentsUntil(Iterable<T> iterable)
iterable
- Selector marking when the operation should stoppublic Q prev()
public Q prev(String selector)
selector
- Previous sibling filterpublic Q prev(Predicate<T> predicate)
predicate
- Previous sibling filterpublic Q prev(Iterable<T> iterable)
iterable
- Previous sibling filterpublic Q prevAll()
public Q prevAll(String selector)
selector
- Previous siblings filterpublic Q prevAll(Predicate<T> predicate)
predicate
- Previous siblings filterpublic Q prevAll(Iterable<T> iterable)
iterable
- Previous siblings filterpublic Q prevUntil(String until)
until
- Selector marking when the operation should stoppublic Q prevUntil(Predicate<T> predicate)
predicate
- Selector marking when the operation should stoppublic Q prevUntil(Iterable<T> iterable)
iterable
- Selector marking when the operation should stoppublic Q searchStrategy(SearchStrategy strategy)
find()
and
has(String)
functions.strategy
- Search strategy typepublic Q siblings()
public Q siblings(String selector)
selector
- Siblings filterpublic Q siblings(Predicate<T> predicate)
predicate
- Siblings filterpublic Q siblings(Iterable<T> iterable)
iterable
- Siblings filterpublic Q slice(int from)
from
Resources from the collection.from
- How many Resources to cut outpublic Q slice(int from, int to)
from
- Low endpoint (inclusive) of the subcollectionto
- High endpoint (inclusive) of the subcollectionpublic Q unique()
HashSet
to store the processed elements, which may result
in an increased memory usage for the big collections.protected abstract Q clone(AbstractQuery<T,Q> original, SearchStrategy strategy)
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.