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

com.github.rutledgepaulv.qbuilders.delegates.virtual.NumberPropertyDelegate Maven / Gradle / Ivy

/*
 *
 *  *  com.github.rutledgepaulv.qbuilders.delegates.virtual.NumberPropertyDelegate
 *  *  *
 *  *  * Copyright (C) 2016 Paul Rutledge 
 *  *  *
 *  *  * This software may be modified and distributed under the terms
 *  *  * of the MIT license.  See the LICENSE file for details.
 *  *
 *
 */

package com.github.rutledgepaulv.qbuilders.delegates.virtual;

import com.github.rutledgepaulv.qbuilders.builders.QBuilder;
import com.github.rutledgepaulv.qbuilders.conditions.Condition;
import com.github.rutledgepaulv.qbuilders.operators.ComparisonOperator;
import com.github.rutledgepaulv.qbuilders.properties.virtual.NumberProperty;
import com.github.rutledgepaulv.qbuilders.structures.FieldPath;

import java.util.Collections;

public abstract class NumberPropertyDelegate, S extends Number>
        extends ListablePropertyDelegate implements NumberProperty {

    protected NumberPropertyDelegate(FieldPath field, T canonical) {
        super(field, canonical);
    }

    public final Condition gt(S number) {
        return condition(getField(), ComparisonOperator.GT, Collections.singletonList(number));
    }

    public final Condition lt(S number) {
        return condition(getField(), ComparisonOperator.LT, Collections.singletonList(number));
    }

    public final Condition gte(S number) {
        return condition(getField(), ComparisonOperator.GTE, Collections.singletonList(number));
    }

    public final Condition lte(S number) {
        return condition(getField(), ComparisonOperator.LTE, Collections.singletonList(number));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy