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

com.github.damianwajser.factories.jsonbased.criteria.Criteria Maven / Gradle / Ivy

There is a newer version: 1.28.6
Show newest version
package com.github.damianwajser.factories.jsonbased.criteria;

import java.util.ArrayList;
import java.util.Collection;

public class Criteria {

	private Collection> criterionCollection;
	private T defaultResult;

	public Criteria() {
		this(null, null);
	}

	public Criteria(T defaultResult) {
		this(defaultResult, null);
	}

	public Criteria(Collection> criteria) {
		this(null, criteria);
	}

	public Criteria(T defaultResult, Collection> criteria) {
		this.defaultResult = defaultResult;
		this.criterionCollection = criteria != null ? criteria : new ArrayList<>();
	}

	public Collection> getAllCriterion() {
		return criterionCollection;
	}

	public T getDefaultResult() {
		return defaultResult;
	}

	public Criterion addCriterion(Criterion criterion) {
		this.criterionCollection.add(criterion);
		return criterion;
	}

	public Criterion addCriterion(T defaultResult) {
		return this.addCriterion(new Criterion<>(defaultResult));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy