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

com.github.rutledgepaulv.qbuilders.conditions.Partial Maven / Gradle / Ivy

package com.github.rutledgepaulv.qbuilders.conditions;

import com.github.rutledgepaulv.qbuilders.builders.QBuilder;
import com.github.rutledgepaulv.qbuilders.properties.concrete.*;

import java.util.List;

/**
 * Represents the starting point of a logical condition. It can be brought to
 * completion by specifying a field and specifying a constraint against that field,
 * or by logically composing conditions into a new logically complete condition.
 *
 * @param  The final type of the builder, used for a fluid chaining interface.
 */
public interface Partial> {

    /**
     * For usage when the field is known to contain values of an enum type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    > EnumProperty enumeration(String field);

    /**
     * For usage when the field is known to contain values of a boolean type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    BooleanProperty bool(String field);

    /**
     * For usage when the field is known to contain values of a string type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    StringProperty string(String field);

    /**
     * For usage when the field is known to contain values of a long type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    LongProperty longNum(String field);

    /**
     * For usage when the field is known to contain values of an integer type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    IntegerProperty intNum(String field);

    /**
     * For usage when the field is known to contain values of a numerical short type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    ShortProperty shortNum(String field);

    /**
     * For usage when the field is known to contain values of a numerical float type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    FloatProperty floatNum(String field);

    /**
     * For usage when the field is known to contain values of a numerical double type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    DoubleProperty doubleNum(String field);

    /**
     * For usage when the field is known to contain values of a point-in-time type.
     *
     * @param field The name of the field.
     *
     * @return The property interface so that a constraint can be set against the field.
     */
    InstantProperty instant(String field);

    /**
     * For usage when the field is a multivalued field of objects who themselves can
     * be tested against a condition.
     *
     * @param field The name of the multivalued field.
     * @param  The kind of the subquery condition..
     *
     * @return The property interface so that a condition constraint can be set against the field.
     */
    > ConditionProperty condition(String field);

    /**
     * Allows for composing a list of conditions in a "any match" fashion.
     *
     * @param conditions The list of conditions to combine.
     *
     * @return The logical condition that represents the composition of the list.
     */
    Condition or(List> conditions);

    /**
     * Allows for composing a list of conditions in a "all match" fashion.
     *
     * @param conditions The list of conditions to combine.
     *
     * @return The logical condition that represents the composition of the list.
     */
    Condition and(List> conditions);

    /**
     * Allows for composing a list of conditions in a "any match" fashion.
     *
     * @param c1 The first condition to combine.
     * @param c2 The second condition to combine.
     * @param cn Any other conditions to combine.
     *
     * @return The logical condition that represents the composition of the list.
     */
    Condition or(Condition c1, Condition c2, Condition... cn);

    /**
     * Allows for composing a list of conditions in a "all match" fashion.
     *
     * @param c1 The first condition to combine.
     * @param c2 The second condition to combine.
     * @param cn Any other conditions to combine.
     *
     * @return The logical condition that represents the composition of the list.
     */
    Condition and(Condition c1, Condition c2, Condition... cn);

}