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

io.sphere.sdk.queries.ComparisonQueryPredicate Maven / Gradle / Ivy

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

final class ComparisonQueryPredicate extends QueryModelQueryPredicate {
    private final V value;
    private final String sign;

    ComparisonQueryPredicate(final QueryModel queryModel, final V value, final String sign) {
        super(queryModel);
        this.value = value;
        this.sign = sign;
    }

    @Override
    protected String render() {
        return sign + value;
    }

    public static  ComparisonQueryPredicate ofIsLessThan(final QueryModel queryModel, final V value) {
        return of(queryModel, value, "<");
    }

    public static  ComparisonQueryPredicate ofIsGreaterThan(final QueryModel queryModel, final V value) {
        return of(queryModel, value, ">");
    }

    public static  ComparisonQueryPredicate ofGreaterThanOrEqualTo(final QueryModel queryModel, final V value) {
        return of(queryModel, value, ">=");
    }

    public static  ComparisonQueryPredicate ofIsLessThanOrEqualTo(final QueryModel queryModel, final V value) {
        return of(queryModel, value, "<=");
    }

    public static  ComparisonQueryPredicate ofIsEqualTo(final QueryModel queryModel, final V value) {
        return of(queryModel, value, "=");
    }

    public static  ComparisonQueryPredicate ofIsNotEqualTo(final QueryModel queryModel, final V value) {
        return of(queryModel, value, "<>");
    }

    private static  ComparisonQueryPredicate of(final QueryModel queryModel, final V value, final String sign) {
        return new ComparisonQueryPredicate<>(queryModel, value, sign);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy