Class Beans
java.lang.Object
org.microbean.bean.Beans
- All Implemented Interfaces:
Reducible<AttributedType,,Bean<?>> Selectable<AttributedType,Bean<?>>
public final class Beans
extends Object
implements Selectable<AttributedType,Bean<?>>, Reducible<AttributedType,Bean<?>>
- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBeans(Selectable<AttributedType, Bean<?>> s) Creates a newBeans.Beans(Selectable<AttributedType, Bean<?>> s, Reducible<AttributedType, Bean<?>> r) Creates a newBeans. -
Method Summary
Modifier and TypeMethodDescriptionstatic final Selectable<AttributedType, Bean<?>> cachingSelectableOf(Matcher<? super AttributedType, ? super Id> idMatcher, Map<? extends AttributedType, ? extends List<Bean<?>>> selections, Collection<? extends Bean<?>> beans) Returns a newSelectablethat caches its results.final Bean<?> Given a criteria object, which may benull, returns an object that represents the reduction of a notional collection of objects.Selects and returns an immutableListrepresenting a sublist of thisSelectable's elements, as mediated by the supplied criteria.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.microbean.bean.Selectable
list
-
Constructor Details
-
Beans
Creates a newBeans.Beaninstances selected by the suppliedSelectablewill be reduced using aRankedReducer.- Parameters:
s- aSelectable; must not benull- See Also:
-
Beans
Creates a newBeans.- Parameters:
s- aSelectable; must not benullr- aReducibleto apply to elements selected by the suppliedSelectable; must not benull- See Also:
-
-
Method Details
-
select
Description copied from interface:SelectableSelects and returns an immutableListrepresenting a sublist of thisSelectable's elements, as mediated by the supplied criteria.Implementations of this method must be idempotent and must return a determinate value.
Implementations of this method must not return
null.Implementations of this method should not call
Selectable.list(), since that method is typically implemented in terms of this one.- Specified by:
selectin interfaceSelectable<AttributedType,Bean<?>> - Parameters:
c- the criteria to use; may benull- Returns:
- an immutable sublist of this
Selectable's elements; nevernull - See Also:
-
reduce
Description copied from interface:ReducibleGiven a criteria object, which may benull, returns an object that represents the reduction of a notional collection of objects.Most
Reducibleimplementations will return determine values from invocations of this method, but there is no requirement to do so.- Specified by:
reducein interfaceReducible<AttributedType,Bean<?>> - Parameters:
c- the criteria; may benullto indicate no criteria- Returns:
- a single object, or
null
-
cachingSelectableOf
public static final Selectable<AttributedType,Bean<?>> cachingSelectableOf(Matcher<? super AttributedType, ? super Id> idMatcher, Map<? extends AttributedType, ? extends List<Bean<?>>> selections, Collection<? extends Bean<?>> beans) Returns a newSelectablethat caches its results.The cache is unbounded.
- Parameters:
idMatcher- anIdMatcher; must not benullselections- a (normally empty)Mapof precomputed selections; must not benullbeans- aCollectionofBeans; must not benull- Returns:
- a new
Selectable; nevernull - Throws:
NullPointerException- if any argument isnull
-