T
- type of the resourceV
- type of the valuepublic class TermFacetSearchModelImpl<T,V> extends Base implements TermFacetSearchModel<T,V>
Modifier and Type | Field and Description |
---|---|
protected String |
alias |
protected Boolean |
isCountingProducts |
protected SearchModel<T> |
searchModel |
protected Function<V,String> |
typeSerializer |
Modifier | Constructor and Description |
---|---|
protected |
TermFacetSearchModelImpl(SearchModel<T> searchModel,
Function<V,String> typeSerializer) |
protected |
TermFacetSearchModelImpl(SearchModel<T> searchModel,
Function<V,String> typeSerializer,
String alias,
Boolean isCountingProducts) |
Modifier and Type | Method and Description |
---|---|
TermFacetExpression<T> |
allTerms()
Generates an expression to obtain the facets of the attribute for all values.
|
String |
getAlias()
The alias related to the facet.
|
SearchModel<T> |
getSearchModel()
The search model for the facet.
|
Boolean |
isCountingProducts()
Whether the facet is counting products.
|
static <T,V> TermFacetSearchModelImpl<T,V> |
of(String attributePath,
Function<V,String> typeSerializer)
Creates an instance of the search model to generate term facet expressions.
|
FilteredFacetExpression<T> |
onlyTerm(Iterable<V> values)
Generates an expression to obtain the facets of the attribute for only the given values.
|
FilteredFacetExpression<T> |
onlyTerm(V value)
Generates an expression to obtain the facet of the attribute for only the given value.
|
FilteredFacetExpression<T> |
onlyTermAsString(Iterable<String> values)
Generates an expression to obtain the facets of the attribute for only the given values.
|
TermFacetSearchModel<T,V> |
withAlias(String alias)
Allows to set an alias to identify the facet.
|
TermFacetSearchModel<T,V> |
withCountingProducts(Boolean isCountingProducts)
Allows to enable/disable the counting of products.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
onlyTermAsString
getAlias, getSearchModel, isCountingProducts
protected final SearchModel<T> searchModel
protected final Boolean isCountingProducts
protected TermFacetSearchModelImpl(SearchModel<T> searchModel, Function<V,String> typeSerializer, String alias, Boolean isCountingProducts)
protected TermFacetSearchModelImpl(SearchModel<T> searchModel, Function<V,String> typeSerializer)
public TermFacetSearchModel<T,V> withAlias(String alias)
withAlias
in interface FacetSearchModel<T,V>
withAlias
in interface TermFacetSearchModel<T,V>
alias
- the identifier to use for the facetpublic TermFacetSearchModel<T,V> withCountingProducts(Boolean isCountingProducts)
withCountingProducts
in interface FacetSearchModel<T,V>
withCountingProducts
in interface TermFacetSearchModel<T,V>
isCountingProducts
- whether to count products or notpublic TermFacetExpression<T> allTerms()
allTerms
in interface FacetSearchModel<T,V>
public FilteredFacetExpression<T> onlyTerm(V value)
onlyTerm
in interface FacetSearchModel<T,V>
onlyTerm
in interface TermFacetSearchModel<T,V>
value
- the value from which to obtain the facetpublic FilteredFacetExpression<T> onlyTerm(Iterable<V> values)
onlyTerm
in interface FacetSearchModel<T,V>
onlyTerm
in interface TermFacetSearchModel<T,V>
values
- the values from which to obtain the facetspublic static <T,V> TermFacetSearchModelImpl<T,V> of(String attributePath, Function<V,String> typeSerializer)
of
in interface TermFacetSearchModel<T,V>
T
- type of the resourceV
- type of the valueattributePath
- the path of the attribute as expected by Composable Commerce (e.g. "variants.attributes.color.key")typeSerializer
- the function to convert the provided value to a string accepted by Composable Commerce@Nullable public String getAlias()
getAlias
in interface FacetSearchModel<T,V>
public Boolean isCountingProducts()
isCountingProducts
in interface FacetSearchModel<T,V>
public SearchModel<T> getSearchModel()
FacetSearchModel
getSearchModel
in interface FacetSearchModel<T,V>
public FilteredFacetExpression<T> onlyTermAsString(Iterable<String> values)
onlyTermAsString
in interface FacetSearchModel<T,V>
values
- the values from which to obtain the facets