![JAR search and dependency download from the Maven repository](/logo.png)
com.bq.oss.lib.queries.ListQueryLiteral Maven / Gradle / Ivy
package com.bq.oss.lib.queries;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.bq.oss.lib.queries.exception.QueryMatchingException;
import com.bq.oss.lib.queries.request.QueryLiteral;
import com.bq.oss.lib.queries.request.QueryOperator;
public class ListQueryLiteral extends QueryLiteral> {
public ListQueryLiteral() {
super();
}
public ListQueryLiteral(List list) {
super(list);
}
@Override
protected boolean in(Object object) throws QueryMatchingException {
for (QueryLiteral queryLiteral : literal) {
if (queryLiteral.operate(QueryOperator.$EQ, object)) {
return true;
}
}
return false;
}
@Override
protected boolean all(Object object) throws QueryMatchingException {
List objectList = (List) object;
for (QueryLiteral queryLiteral : literal) {
Iterator iterator = objectList.iterator();
boolean flag = false;
while (iterator.hasNext() && !flag) {
flag = queryLiteral.operate(QueryOperator.$EQ, iterator.next());
}
if (!flag) {
return false;
}
}
return true;
}
@Override
protected boolean eq(Object object) throws QueryMatchingException {
List objectList = (List) object;
return objectList.size() == literal.size() && all(object);
}
@Override
protected boolean ne(Object object) throws QueryMatchingException {
List objectList = (List) object;
return objectList.size() != literal.size() || !all(object);
}
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy