Package com.helger.commons.hierarchy
Class ChildrenProviderHasChildren<CHILDTYPE extends IHasChildren<CHILDTYPE>>
- java.lang.Object
-
- com.helger.commons.hierarchy.ChildrenProviderHasChildren<CHILDTYPE>
-
- Type Parameters:
CHILDTYPE- The data type of the child objects.
- All Implemented Interfaces:
IChildrenProvider<CHILDTYPE>
- Direct Known Subclasses:
ChildrenProviderHasChildrenSorted,ChildrenProviderHasChildrenSorting,ChildrenProviderHasChildrenWithID
@Immutable public class ChildrenProviderHasChildren<CHILDTYPE extends IHasChildren<CHILDTYPE>> extends Object implements IChildrenProvider<CHILDTYPE>
A standard implementation of theIChildrenProviderinterface that works with all types that implementIHasChildren.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description ChildrenProviderHasChildren()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ICommonsCollection<? extends CHILDTYPE>getAllChildren(CHILDTYPE aCurrent)Get the children of the passed object.intgetChildCount(CHILDTYPE aCurrent)booleanhasChildren(CHILDTYPE aCurrent)Check if an item has children.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.helger.commons.hierarchy.IChildrenProvider
hasNoChildren
-
-
-
-
Method Detail
-
hasChildren
public final boolean hasChildren(@Nullable CHILDTYPE aCurrent)
Description copied from interface:IChildrenProviderCheck if an item has children.- Specified by:
hasChildrenin interfaceIChildrenProvider<CHILDTYPE extends IHasChildren<CHILDTYPE>>- Parameters:
aCurrent- The object to determine the children of. Nonullor non-nullconstraint possible.- Returns:
trueif this item has children,falseotherwise.
-
getChildCount
@Nonnegative public final int getChildCount(@Nullable CHILDTYPE aCurrent)
- Specified by:
getChildCountin interfaceIChildrenProvider<CHILDTYPE extends IHasChildren<CHILDTYPE>>- Parameters:
aCurrent- The object to determine the children count of. Nonullor non-nullconstraint possible.- Returns:
- The number of contained direct children. Always ≥ 0.
-
getAllChildren
@Nullable public ICommonsCollection<? extends CHILDTYPE> getAllChildren(@Nullable CHILDTYPE aCurrent)
Description copied from interface:IChildrenProviderGet the children of the passed object.- Specified by:
getAllChildrenin interfaceIChildrenProvider<CHILDTYPE extends IHasChildren<CHILDTYPE>>- Parameters:
aCurrent- The object to determine the children of. Nonullor non-nullconstraint possible.- Returns:
- The child objects, or
nullif there are no children. Ifnullis passed, the resolver is expected to return any possible top level (root) elements. This method may NOT returnnullif the call toIChildrenProvider.hasChildren(Object)with the same object returnedtrue.
-
-