Package com.mewna.catnip.cache.view
Class CompositeNamedCacheView<T>
java.lang.Object
com.mewna.catnip.cache.view.CompositeCacheView<T>
com.mewna.catnip.cache.view.CompositeNamedCacheView<T>
- Type Parameters:
T
- Type of the entity held by this cache.
- All Implemented Interfaces:
CacheView<T>
,NamedCacheView<T>
,Iterable<T>
A
NamedCacheView
that's equivalent to a collection of provided ones.
Any update to any of the provided views will update this view.- Since:
- 12/15/18
- Author:
- natanbc
-
Field Summary
Fields inherited from class com.mewna.catnip.cache.view.CompositeCacheView
sources
-
Constructor Summary
ConstructorDescriptionCompositeNamedCacheView
(Collection<? extends CacheView<T>> sources, Function<T, String> nameFunction) -
Method Summary
Modifier and TypeMethodDescriptionfindByName
(String name, boolean ignoreCase) Finds all entities with a name equal to the provided value.<C extends Collection<T>>
CfindByName
(String name, boolean ignoreCase, Supplier<C> supplier) Finds all entities with a name equal to the provided value.findByNameContains
(String name, boolean ignoreCase) Finds all entities whose name contains the provided value.<C extends Collection<T>>
CfindByNameContains
(String name, boolean ignoreCase, Supplier<C> supplier) Finds all entities whose name contains the provided value.findByNameEndsWith
(String name, boolean ignoreCase) Finds all entities whose name ends with the provided value.<C extends Collection<T>>
CfindByNameEndsWith
(String name, boolean ignoreCase, Supplier<C> supplier) Finds all entities whose name ends with the provided value.findByNameStartsWith
(String name, boolean ignoreCase) Finds all entities whose name starts with the provided value.<C extends Collection<T>>
CfindByNameStartsWith
(String name, boolean ignoreCase, Supplier<C> supplier) Finds all entities whose name starts with the provided value.Methods inherited from class com.mewna.catnip.cache.view.CompositeCacheView
allMatch, anyMatch, collect, collect, count, find, find, findAny, forEach, getById, isEmpty, iterator, keys, max, min, noneMatch, reduce, reduce, reduce, size, snapshot, snapshot, values
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mewna.catnip.cache.view.CacheView
allMatch, anyMatch, collect, collect, count, find, find, findAny, forEach, getById, getById, isEmpty, keys, max, min, noneMatch, reduce, reduce, reduce, size, snapshot, snapshot, spliterator, stream, values
Methods inherited from interface com.mewna.catnip.cache.view.NamedCacheView
findByName, findByName, findByNameContains, findByNameContains, findByNameEndsWith, findByNameEndsWith, findByNameStartsWith, findByNameStartsWith
-
Field Details
-
nameFunction
-
-
Constructor Details
-
CompositeNamedCacheView
-
-
Method Details
-
findByName
Description copied from interface:NamedCacheView
Finds all entities with a name equal to the provided value.- Specified by:
findByName
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.- Returns:
- All elements that have a name equal to the provided.
- See Also:
-
findByName
@Nonnull public <C extends Collection<T>> C findByName(@Nonnull String name, boolean ignoreCase, @Nonnull Supplier<C> supplier) Description copied from interface:NamedCacheView
Finds all entities with a name equal to the provided value.- Specified by:
findByName
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.supplier
- Supplier for the collection to add the elements to. The returned collection must be mutable.- Returns:
- The collection returned by
supplier
, after adding the matching elements. May be empty. - See Also:
-
findByNameContains
Description copied from interface:NamedCacheView
Finds all entities whose name contains the provided value.- Specified by:
findByNameContains
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.- Returns:
- All elements that have a name containing the provided.
- See Also:
-
findByNameContains
@Nonnull public <C extends Collection<T>> C findByNameContains(@Nonnull String name, boolean ignoreCase, @Nonnull Supplier<C> supplier) Description copied from interface:NamedCacheView
Finds all entities whose name contains the provided value.- Specified by:
findByNameContains
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.supplier
- Supplier for the collection to add the elements to. The returned collection must be mutable.- Returns:
- The collection returned by
supplier
, after adding the matching elements. May be empty. - See Also:
-
findByNameStartsWith
Description copied from interface:NamedCacheView
Finds all entities whose name starts with the provided value.- Specified by:
findByNameStartsWith
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.- Returns:
- All elements that have a name starting with the provided.
- See Also:
-
findByNameStartsWith
@Nonnull public <C extends Collection<T>> C findByNameStartsWith(@Nonnull String name, boolean ignoreCase, @Nonnull Supplier<C> supplier) Description copied from interface:NamedCacheView
Finds all entities whose name starts with the provided value.- Specified by:
findByNameStartsWith
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.supplier
- Supplier for the collection to add the elements to. The returned collection must be mutable.- Returns:
- The collection returned by
supplier
, after adding the matching elements. May be empty. - See Also:
-
findByNameEndsWith
Description copied from interface:NamedCacheView
Finds all entities whose name ends with the provided value.- Specified by:
findByNameEndsWith
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.- Returns:
- All elements that have a name ending with the provided.
- See Also:
-
findByNameEndsWith
@Nonnull public <C extends Collection<T>> C findByNameEndsWith(@Nonnull String name, boolean ignoreCase, @Nonnull Supplier<C> supplier) Description copied from interface:NamedCacheView
Finds all entities whose name ends with the provided value.- Specified by:
findByNameEndsWith
in interfaceNamedCacheView<T>
- Parameters:
name
- Name to search for.ignoreCase
- Ignore casing differences between the entity names and the provided name.supplier
- Supplier for the collection to add the elements to. The returned collection must be mutable.- Returns:
- The collection returned by
supplier
, after adding the matching elements. May be empty. - See Also:
-