All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.search.model.TermFacetSearchModel Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.search.model;

import io.sphere.sdk.search.FilteredFacetExpression;
import io.sphere.sdk.search.TermFacetExpression;

import java.util.function.Function;

/**
 * Model to build term facets.
 * @param  type of the resource
 * @param  type of the value
 */
public class TermFacetSearchModel extends TermFacetBaseSearchModel {

    TermFacetSearchModel(final SearchModel searchModel, final Function typeSerializer, final String alias) {
        super(searchModel, typeSerializer, alias);
    }

    TermFacetSearchModel(final SearchModel searchModel, final Function typeSerializer) {
        super(searchModel, typeSerializer);
    }

    @Override
    public TermFacetSearchModel withAlias(final String alias) {
        return new TermFacetSearchModel<>(searchModel, typeSerializer, alias);
    }

    @Override
    public TermFacetExpression allTerms() {
        return super.allTerms();
    }

    @Override
    public FilteredFacetExpression onlyTerm(final V value) {
        return super.onlyTerm(value);
    }

    @Override
    public FilteredFacetExpression onlyTerm(final Iterable values) {
        return super.onlyTerm(values);
    }

    /**
     * Creates an instance of the search model to generate term facet expressions.
     * @param attributePath the path of the attribute as expected by Commercetools Platform (e.g. "variants.attributes.color.key")
     * @param typeSerializer the function to convert the provided value to a string accepted by Commercetools Platform
     * @param  type of the resource
     * @param  type of the value
     * @return new instance of TermFacetSearchModel
     */
    public static  TermFacetSearchModel of(final String attributePath, final Function typeSerializer) {
        return new TermFacetSearchModel<>(new SearchModelImpl<>(attributePath), typeSerializer);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy