CHILDTYPE - The data type of the child objects.@Immutable public class ChildrenProviderSorting<CHILDTYPE> extends Object implements IChildrenProvider<CHILDTYPE>
IChildrenProvider that returns the children in
getAllChildren(Object) sorted.| Constructor and Description |
|---|
ChildrenProviderSorting(IChildrenProvider<CHILDTYPE> aCP,
Comparator<? super CHILDTYPE> aComparator)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ICommonsList<? extends CHILDTYPE> |
getAllChildren(CHILDTYPE aCurrent)
Get the children of the passed object.
|
int |
getChildCount(CHILDTYPE aCurrent) |
IChildrenProvider<CHILDTYPE> |
getChildrenProvider() |
Comparator<? super CHILDTYPE> |
getComparator() |
boolean |
hasChildren(CHILDTYPE aCurrent)
Check if an item has children.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasNoChildrenpublic ChildrenProviderSorting(@Nonnull IChildrenProvider<CHILDTYPE> aCP, @Nonnull Comparator<? super CHILDTYPE> aComparator)
aCP - The children provider to be wrappedaComparator - The comparator to be used for sorting children.@Nonnull public IChildrenProvider<CHILDTYPE> getChildrenProvider()
@Nonnull public Comparator<? super CHILDTYPE> getComparator()
public final boolean hasChildren(@Nullable CHILDTYPE aCurrent)
IChildrenProviderhasChildren in interface IChildrenProvider<CHILDTYPE>aCurrent - The object to determine the children of. No null or
non- null constraint possible.true if this item has children, false
otherwise.public final int getChildCount(@Nullable CHILDTYPE aCurrent)
getChildCount in interface IChildrenProvider<CHILDTYPE>aCurrent - The object to determine the children count of. No null
or non- null constraint possible.@Nullable public ICommonsList<? extends CHILDTYPE> getAllChildren(@Nullable CHILDTYPE aCurrent)
IChildrenProvidergetAllChildren in interface IChildrenProvider<CHILDTYPE>aCurrent - The object to determine the children of. No null or
non-null constraint possible.null if there are no children.
If null is passed, the resolver is expected to return
any possible top level (root) elements. This method may NOT return
null if the call to IChildrenProvider.hasChildren(Object) with
the same object returned true.Copyright © 2014–2019 Philip Helger. All rights reserved.