Class Selectables
java.lang.Object
org.microbean.bean.Selectables
Utility methods for working with
Selectables.- Author:
- Laird Nelson
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic final <C,E> Selectable <C, E> ambiguityReducing(Selectable<C, E> s, Predicate<? super E> p, ToIntFunction<? super E> ranker) Returns aSelectablethat reduces any ambiguity in the results returned by anotherSelectable, considering alternate status and rank.static final Selectable<AttributedType, Bean<?>> typesafeFiltering(Collection<? extends Bean<?>> beans, Matcher<? super AttributedType, ? super Id> m) Normalizes the suppliedCollectionofBeans and returns aSelectablesuitable for it and the suppliedMatcher.
-
Method Details
-
ambiguityReducing
public static final <C,E> Selectable<C,E> ambiguityReducing(Selectable<C, E> s, Predicate<? super E> p, ToIntFunction<? super E> ranker) Returns aSelectablethat reduces any ambiguity in the results returned by anotherSelectable, considering alternate status and rank.- Type Parameters:
C- the criteria typeE- the element type- Parameters:
s- aSelectable; must not benullp- aPredicatethat tests whether an element is an alternate; must not benullranker- aToIntFunctionthat returns a rank for an alternate; a rank of0indicates no particular rank; must not benull- Returns:
- a non-
nullSelectable - Throws:
NullPointerException- if any argument isnull
-
typesafeFiltering
public static final Selectable<AttributedType, Bean<?>> typesafeFiltering(Collection<? extends Bean<?>> beans, Matcher<? super AttributedType, ? super Id> m) Normalizes the suppliedCollectionofBeans and returns aSelectablesuitable for it and the suppliedMatcher.The returned
Selectabledoes not cache its results.- Parameters:
beans- aCollectionofBeans; must not benullm- aMatcher; must not benull- Returns:
- a non-
nullSelectable - Throws:
NullPointerException- if any argument isnull- See Also:
-