Package com.helger.commons.hierarchy
Interface IChildrenProvider<CHILDTYPE>
-
- Type Parameters:
CHILDTYPE- The type of the children to retrieve.
- All Known Subinterfaces:
IChildrenProviderSorted<CHILDTYPE>,IChildrenProviderWithID<KEYTYPE,CHILDTYPE>
- All Known Implementing Classes:
ChildrenProviderHasChildren,ChildrenProviderHasChildrenSorted,ChildrenProviderHasChildrenSorting,ChildrenProviderHasChildrenWithID,ChildrenProviderSorting,ChildrenProviderSortingWithID
public interface IChildrenProvider<CHILDTYPE>This interface can be used to generically resolved children of a certain object.- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ICommonsCollection<? extends CHILDTYPE>getAllChildren(CHILDTYPE aCurrent)Get the children of the passed object.intgetChildCount(CHILDTYPE aCurrent)default booleanhasChildren(CHILDTYPE aCurrent)Check if an item has children.default booleanhasNoChildren(CHILDTYPE aCurrent)Check if an item has no children.
-
-
-
Method Detail
-
hasChildren
default boolean hasChildren(CHILDTYPE aCurrent)
Check if an item has children.- Parameters:
aCurrent- The object to determine the children of. Nonullor non-nullconstraint possible.- Returns:
trueif this item has children,falseotherwise.
-
hasNoChildren
default boolean hasNoChildren(CHILDTYPE aCurrent)
Check if an item has no children.- Parameters:
aCurrent- The object to determine the children of. Nonullor non-nullconstraint possible.- Returns:
trueif this item has no children,falseotherwise.
-
getChildCount
@Nonnegative int getChildCount(CHILDTYPE aCurrent)
- 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 ICommonsCollection<? extends CHILDTYPE> getAllChildren(CHILDTYPE aCurrent)
Get the children of the passed object.- 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 tohasChildren(Object)with the same object returnedtrue.
-
-