Package de.espirit.common
Class TypedFilter<T>
java.lang.Object
de.espirit.common.TypedFilter<T>
- All Implemented Interfaces:
Filter<T>
,Filter.TypedFilter<T>
,Serializable
Abstract typed filter definition providing base mechanisms and factories to easily create specific kinds of
filters based on its specific object type.
- Since:
- 4.0.17
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.espirit.common.util.Filter
Filter.AndFilter<T>, Filter.CombinedFilter<T>, Filter.EqualFilter<T>, Filter.ImpliesFilter<T>, Filter.NotFilter<T>, Filter.OrFilter<T>, Filter.TypedFilter<T>, Filter.Util
-
Constructor Summary
ConstructorsConstructorDescriptionTypedFilter
(@NotNull Class<T> type) Base constructor for filters based on the given type. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TypedFilter<T>
Creates and returns a class based type filter with no additional conditions.static <T> TypedFilter<T>
Creates and returns a class based type filter based on givenfilter
instance.static <T> TypedFilter<T>
createExcludeFilter
(@NotNull Class<T> type, Class<? extends T>... excludes) Creates and returns a class based type filter with an additional exclude filtering of the specified sub classes.static <T> TypedFilter<T>
createIncludeFilter
(@NotNull Class<T> type, Class<? extends T>... includes) Creates and returns a class based type filter with an additional include filtering of the specified sub classes.Filter the given element and return either an object of this classes type T or null, if the element does not match the filter as defined byFilter.accept(Object)
.getType()
Get the filter type.
-
Constructor Details
-
TypedFilter
Base constructor for filters based on the given type.- Parameters:
type
- The object type filtering on.- Since:
- 4.0.17
-
-
Method Details
-
filter
Filter the given element and return either an object of this classes type T or null, if the element does not match the filter as defined byFilter.accept(Object)
.- Specified by:
filter
in interfaceFilter.TypedFilter<T>
- Parameters:
element
- The element to be filtered.- Returns:
- The correctly typed element or null.
- Since:
- 4.0.17
-
getType
Get the filter type.- Specified by:
getType
in interfaceFilter.TypedFilter<T>
- Returns:
- The filter type.
- Since:
- 4.0.17
-
create
Creates and returns a class based type filter with no additional conditions.- Parameters:
type
- The type to check for.- Returns:
- The created type filter.
- Since:
- 4.0.17
-
create
public static <T> TypedFilter<T> create(@NotNull @NotNull Class<T> type, @NotNull @NotNull Filter<? super T> filter) Creates and returns a class based type filter based on givenfilter
instance.- Type Parameters:
T
- Type of the filter.- Parameters:
type
- The type to check for.filter
- Used for filtering.- Returns:
- The created type filter.
- Since:
- 5.0.3
-
createExcludeFilter
public static <T> TypedFilter<T> createExcludeFilter(@NotNull @NotNull Class<T> type, Class<? extends T>... excludes) Creates and returns a class based type filter with an additional exclude filtering of the specified sub classes.- Type Parameters:
T
- Type of the filter.- Parameters:
type
- The type to check for.excludes
- A list of excluded classes.- Returns:
- The created type filter.
- Since:
- 4.2.416
-
createIncludeFilter
public static <T> TypedFilter<T> createIncludeFilter(@NotNull @NotNull Class<T> type, Class<? extends T>... includes) Creates and returns a class based type filter with an additional include filtering of the specified sub classes.- Type Parameters:
T
- Type of the filter.- Parameters:
type
- The type to check basically for.includes
- A list of included classes that should not be filtered.- Returns:
- The created type filter.
- Since:
- 5.0.3
-