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

com.tvd12.ezydata.database.query.EzyQueryConditionChain Maven / Gradle / Ivy

The newest version!
package com.tvd12.ezydata.database.query;

import com.tvd12.ezyfox.builder.EzyBuilder;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
public class EzyQueryConditionChain {

    protected final List conditionGroups;

    public EzyQueryConditionChain(
        List conditionGroups
    ) {
        this.conditionGroups = conditionGroups;
    }

    public int size() {
        return conditionGroups.size();
    }

    public int getParameterCount() {
        return conditionGroups.stream()
            .mapToInt(EzyQueryConditionGroup::size)
            .sum();
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder implements EzyBuilder {

        protected final List conditionGroups
            = new ArrayList<>();

        public Builder addConditionGroup(EzyQueryConditionGroup conditionGroup) {
            this.conditionGroups.add(conditionGroup);
            return this;
        }

        @Override
        public EzyQueryConditionChain build() {
            return new EzyQueryConditionChain(conditionGroups);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy