mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
CE-781 Add overload constructor that takes Collection of values
This commit is contained in:
@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.model.actions.tables.query;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
@ -93,11 +94,37 @@ public class QFilterCriteria implements Serializable, Cloneable
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public QFilterCriteria(String fieldName, QCriteriaOperator operator, List<Serializable> values)
|
@SuppressWarnings("unchecked")
|
||||||
|
public QFilterCriteria(String fieldName, QCriteriaOperator operator, List<? extends Serializable> values)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.operator = operator;
|
this.operator = operator;
|
||||||
this.values = values == null ? new ArrayList<>() : values;
|
this.values = values == null ? new ArrayList<>() : (List<Serializable>) values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public QFilterCriteria(String fieldName, QCriteriaOperator operator, Collection<? extends Serializable> values)
|
||||||
|
{
|
||||||
|
this.fieldName = fieldName;
|
||||||
|
this.operator = operator;
|
||||||
|
|
||||||
|
if(values == null)
|
||||||
|
{
|
||||||
|
this.values = new ArrayList<>();
|
||||||
|
}
|
||||||
|
else if(values instanceof List list)
|
||||||
|
{
|
||||||
|
this.values = list;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.values = new ArrayList<>(values);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user