- java.lang.Object
-
- org.praxislive.base.FilteredTypes
-
- All Implemented Interfaces:
SupportedTypes
public class FilteredTypes extends Object implements SupportedTypes
An implementation ofSupportedTypes
that can be included in the lookup of a container. The implementation automatically searches the parent lookup for other SupportedTypes, or otherwise aComponentRegistry
.Results can be subject to further filtering, or additional types can be included.
The result is cached. The FilteredTypes must be
reset()
on hierarchy changes, and in any circumstances where the behaviour of the filter or additional types supplier changes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.praxislive.core.protocols.SupportedTypes
SupportedTypes.Result
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FilteredTypes
create(Container context)
Create a FilteredTypes for the provided context.static FilteredTypes
create(Container context, Predicate<ComponentType> filter)
Create a FilteredTypes for the provided context, additionally filtering the available types from the parent by the passed in filter.static FilteredTypes
create(Container context, Predicate<ComponentType> filter, Supplier<List<ComponentType>> additional)
Create a FilteredTypes for the provided context, additionally filtering the available types from the parent by the passed in filter, and adding in types from the supplied list.SupportedTypes.Result
query()
Query the supported types, the same as calling the supported-types control on the providing container.void
reset()
Reset and cause the result to be recalculated on the next call toquery()
.
-
-
-
Method Detail
-
query
public SupportedTypes.Result query()
Description copied from interface:SupportedTypes
Query the supported types, the same as calling the supported-types control on the providing container. The same result will be returned unless the data has changed or otherwise refreshed, so object identity can be used to verify any cached data.- Specified by:
query
in interfaceSupportedTypes
- Returns:
- supported types result
-
reset
public void reset()
Reset and cause the result to be recalculated on the next call toquery()
. The FilteredTypes should be reset on hierarchy changes of the container, and in any circumstances where the behaviour of the filter or additional types supplier changes.
-
create
public static FilteredTypes create(Container context)
Create a FilteredTypes for the provided context. If noSupportedTypes
is found in the parent lookup, then the implementation will attempt to filter theComponentRegistry
result according to the root type.- Parameters:
context
- container this will be added to- Returns:
- instance
-
create
public static FilteredTypes create(Container context, Predicate<ComponentType> filter)
Create a FilteredTypes for the provided context, additionally filtering the available types from the parent by the passed in filter.If the filter is null then a default filter will be used according to root type - see
create(org.praxislive.core.Container)
.- Parameters:
context
- container this will be added tofilter
- filtering to apply to parent result- Returns:
- instance
-
create
public static FilteredTypes create(Container context, Predicate<ComponentType> filter, Supplier<List<ComponentType>> additional)
Create a FilteredTypes for the provided context, additionally filtering the available types from the parent by the passed in filter, and adding in types from the supplied list.If the filter is null then a default filter will be used according to root type - see
create(org.praxislive.core.Container)
.- Parameters:
context
- container this will be added tofilter
- filtering to apply to parent resultadditional
- supplier of a list of additional types- Returns:
- instance
-
-