com.github.damianwajser.factories.jsonbased.criteria.Criteria Maven / Gradle / Ivy
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