Package com.helger.dao.wal
Interface IMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>
- Type Parameters:
INTERFACETYPE- The interface type of the elements handled by the DAO
- All Superinterfaces:
com.helger.commons.lang.IHasSize
- All Known Implementing Classes:
AbstractMapBasedWALDAO
@ThreadSafe
public interface IMapBasedDAO<INTERFACETYPE extends com.helger.commons.id.IHasID<String>>
extends com.helger.commons.lang.IHasSize
Read-only base interface for the MAP based DAO
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsAllIDs(Iterable<String> aIDs) Check if all IDs are containedbooleancontainsAny(Predicate<? super INTERFACETYPE> aFilter) booleancontainsNone(Predicate<? super INTERFACETYPE> aFilter) booleancontainsOnly(Predicate<? super INTERFACETYPE> aFilter) booleancontainsWithID(String sID) voidfindAll(Predicate<? super INTERFACETYPE> aFilter, Consumer<? super INTERFACETYPE> aConsumer) Find all items matching the filter and invoke the consumer on all matching entries.<RETTYPE> voidfindAllMapped(Predicate<? super INTERFACETYPE> aFilter, Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper, Consumer<? super RETTYPE> aConsumer) Find all contained items that match the filter, map them to a different type and invoke the consumer on all mapped items.findFirst(Predicate<? super INTERFACETYPE> aFilter) Find the the first element that matches the filter.<RETTYPE> RETTYPEfindFirstMapped(Predicate<? super INTERFACETYPE> aFilter, Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) voidforEach(BiConsumer<? super String, ? super INTERFACETYPE> aConsumer) Iterate each entryvoidforEach(BiPredicate<? super String, ? super INTERFACETYPE> aFilter, BiConsumer<? super String, ? super INTERFACETYPE> aConsumer) Iterate each entryvoidforEachKey(Consumer<? super String> aConsumer) Iterate each keyvoidforEachKey(Predicate<? super String> aFilter, Consumer<? super String> aConsumer) Iterate each keyvoidforEachValue(Consumer<? super INTERFACETYPE> aConsumer) Iterate each valuevoidforEachValue(Predicate<? super INTERFACETYPE> aFilter, Consumer<? super INTERFACETYPE> aConsumer) Iterate each valuecom.helger.commons.collection.impl.ICommonsList<? extends INTERFACETYPE>getAll()com.helger.commons.collection.impl.ICommonsList<? extends INTERFACETYPE>getAll(Predicate<? super INTERFACETYPE> aFilter) com.helger.commons.collection.impl.ICommonsSet<String><RETTYPE> com.helger.commons.collection.impl.ICommonsList<RETTYPE>getAllMapped(Predicate<? super INTERFACETYPE> aFilter, Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) Get all contained items matching the provided filter and map them to something else.intgetCount(Predicate<? super INTERFACETYPE> aFilter) <T> com.helger.commons.collection.impl.ICommonsList<T>getNone()Methods inherited from interface com.helger.commons.lang.IHasSize
isEmpty, isNotEmpty, size
-
Method Details
-
getNone
- Type Parameters:
T- Response type.- Returns:
- An empty collection of the suitable implementation type.
- Since:
- 9.4.5 in the interface
-
getAll
@Nonnull @ReturnsMutableCopy com.helger.commons.collection.impl.ICommonsList<? extends INTERFACETYPE> getAll()- Returns:
- A list of all contained items. Never
null.
-
getAll
@Nonnull @ReturnsMutableCopy com.helger.commons.collection.impl.ICommonsList<? extends INTERFACETYPE> getAll(@Nullable Predicate<? super INTERFACETYPE> aFilter) - Parameters:
aFilter- Filter to be applied. May benull.- Returns:
- A list of all contained items matching the filter. Never
null.
-
findAll
void findAll(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Consumer<? super INTERFACETYPE> aConsumer) Find all items matching the filter and invoke the consumer on all matching entries.- Parameters:
aFilter- The filter to be applied. May benull.aConsumer- The consumer to be invoked for all matches. May not benull.
-
getAllMapped
@Nonnull @ReturnsMutableCopy <RETTYPE> com.helger.commons.collection.impl.ICommonsList<RETTYPE> getAllMapped(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) Get all contained items matching the provided filter and map them to something else.- Type Parameters:
RETTYPE- Return type to which is mapped- Parameters:
aFilter- The filter to be applied. May benull.aMapper- The mapper to be invoked. May not benull.- Returns:
- The list all matching and mapped elements. Never
null.
-
findAllMapped
<RETTYPE> void findAllMapped(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper, @Nonnull Consumer<? super RETTYPE> aConsumer) Find all contained items that match the filter, map them to a different type and invoke the consumer on all mapped items.- Type Parameters:
RETTYPE- Return type to which is mapped- Parameters:
aFilter- The filter to be applied. May benull.aMapper- The mapper to be invoked. May not benull.aConsumer- The consumer to be invoked for all matches. May not benull.
-
findFirst
Find the the first element that matches the filter.- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
- The first matching item or
null.
-
findFirstMapped
@Nullable <RETTYPE> RETTYPE findFirstMapped(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nonnull Function<? super INTERFACETYPE, ? extends RETTYPE> aMapper) -
containsAny
- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
trueif at least one item matches the filter
-
containsNone
- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
trueif no item matches the filter
-
containsOnly
- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
trueif all items match the filter
-
containsWithID
- Parameters:
sID- The ID to be checked. May benull.- Returns:
trueif an item with the provided ID is contained.
-
forEach
Iterate each entry- Parameters:
aConsumer- Consumer to use. May benull.- Since:
- 9.4.5 in the interface
-
forEach
void forEach(@Nullable BiPredicate<? super String, ? super INTERFACETYPE> aFilter, @Nullable BiConsumer<? super String, ? super INTERFACETYPE> aConsumer) Iterate each entry- Parameters:
aFilter- Optional filter to limit the entries for which the consumer is called. May benull.aConsumer- Consumer to use. May benull.- Since:
- 9.4.5 in the interface
-
forEachKey
Iterate each key- Parameters:
aConsumer- Consumer to use. May benull.- Since:
- 9.4.5 in the interface
-
forEachKey
void forEachKey(@Nullable Predicate<? super String> aFilter, @Nullable Consumer<? super String> aConsumer) Iterate each key- Parameters:
aFilter- Optional filter to limit the entries for which the consumer is called. May benull.aConsumer- Consumer to use. May benull.- Since:
- 9.4.5 in the interface
-
forEachValue
Iterate each value- Parameters:
aConsumer- Consumer to use. May benull.- Since:
- 9.4.5 in the interface
-
forEachValue
void forEachValue(@Nullable Predicate<? super INTERFACETYPE> aFilter, @Nullable Consumer<? super INTERFACETYPE> aConsumer) Iterate each value- Parameters:
aFilter- Optional filter to limit the entries for which the consumer is called. May benull.aConsumer- Consumer to use. May benull.- Since:
- 9.4.5 in the interface
-
containsAllIDs
Check if all IDs are contained- Parameters:
aIDs- IDs to check- Returns:
trueif all IDs are contained- Since:
- 9.4.5 in the interface
-
getAllIDs
- Returns:
- A set with the IDs of all contained items. Never
nullbut maybe empty.
-
getCount
- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
- The number of items matching the provided filter. Always ≥ 0.
-