- All Implemented Interfaces:
SupportedTypes
SupportedTypes that can be included in the
lookup of a container. The implementation automatically searches the parent
lookup for other SupportedTypes, or otherwise a ComponentRegistry.
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
Modifier and TypeMethodDescriptionstatic FilteredTypesCreate a FilteredTypes for the provided context.static FilteredTypescreate(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 FilteredTypescreate(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.static FilteredTypescreate(Container context, Predicate<ComponentType> filter, Supplier<List<ComponentType>> additional, boolean includeParentAdditional) 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.query()Query the supported types, the same as calling the supported-types control on the providing container.voidreset()Reset and cause the result to be recalculated on the next call toquery().
-
Method Details
-
query
Description copied from interface:SupportedTypesQuery 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:
queryin 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
Create a FilteredTypes for the provided context. If noSupportedTypesis found in the parent lookup, then the implementation will attempt to filter theComponentRegistryresult according to the root type.- Parameters:
context- container this will be added to- Returns:
- instance
-
create
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
-
create
public static FilteredTypes create(Container context, Predicate<ComponentType> filter, Supplier<List<ComponentType>> additional, boolean includeParentAdditional) 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.The boolean flag allows to filter out additional types added by the parent, if the parent is also using an instance of FilteredTypes.
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 typesincludeParentAdditional- whether to include additional types from the parent- Returns:
- instance
-