Class Filters
- java.lang.Object
-
- co.elasticsearch.enterprisesearch.client.model.request.search.filter.Filters
-
public class Filters extends Object
Utility class that wraps an instance of a filter and provides methods for working with filters.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<BooleanFilter>getBooleanFilter()Ensure that the filter is a bool filter, and cast it to a BooleanFilter<T extends FieldFilter>
Optional<T>getFieldFilter(Class<T> clazz)Ensure that the filter is a field filter, and cast it to the appropriate class typebooleanhasAllFilter()Determine whether the filter contains a nested all filterbooleanhasAnyFilter()Determine whether the filter contains a nested any filterbooleanhasNoneFilter()Determine whether the filter contains a nested none filterbooleanisBoolean()Determine whether the filter is a bool filterbooleanisField()Determine whether the filter applies to a field.
-
-
-
Constructor Detail
-
Filters
public Filters(Filter filter)
-
-
Method Detail
-
isBoolean
public boolean isBoolean()
Determine whether the filter is a bool filter- Returns:
- true if the filter is a BooleanFilter, otherwise false
-
hasAnyFilter
public boolean hasAnyFilter()
Determine whether the filter contains a nested any filter- Returns:
- true if the filter is a BooleanFilter and it contains an any filter
-
hasAllFilter
public boolean hasAllFilter()
Determine whether the filter contains a nested all filter- Returns:
- true if the filter is a BooleanFilter and it contains an all filter
-
hasNoneFilter
public boolean hasNoneFilter()
Determine whether the filter contains a nested none filter- Returns:
- true if the filter is a BooleanFilter and it contains a none filter
-
isField
public boolean isField()
Determine whether the filter applies to a field. Boolean filters do not directly apply to fields and would return false- Returns:
- true if the filter applies to a field, otherwise false.
-
getFieldFilter
public <T extends FieldFilter> Optional<T> getFieldFilter(Class<T> clazz)
Ensure that the filter is a field filter, and cast it to the appropriate class type- Type Parameters:
T- The given concrete FieldFilter class- Parameters:
clazz- The concrete FieldFilter class that the filter represents- Returns:
- an Optional that will contain the given FieldFilter class type, or an empty Optional if the filter is null or is not the given class type
-
getBooleanFilter
public Optional<BooleanFilter> getBooleanFilter()
Ensure that the filter is a bool filter, and cast it to a BooleanFilter- Returns:
- an Optional that will contain the given BooleanFilter, or an empty Optional if the filter is null or is not a BooleanFilter
-
-