75 lines
2.2 KiB
Java
75 lines
2.2 KiB
Java
package org.greenrobot.greendao.query;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.ListIterator;
|
|
import org.greenrobot.greendao.AbstractDao;
|
|
import org.greenrobot.greendao.DaoException;
|
|
import org.greenrobot.greendao.Property;
|
|
import org.greenrobot.greendao.query.WhereCondition;
|
|
|
|
/* loaded from: classes2.dex */
|
|
class WhereCollector<T> {
|
|
private final AbstractDao<T, ?> a;
|
|
private final List<WhereCondition> b = new ArrayList();
|
|
|
|
WhereCollector(AbstractDao<T, ?> abstractDao, String str) {
|
|
this.a = abstractDao;
|
|
}
|
|
|
|
void a(WhereCondition whereCondition, WhereCondition... whereConditionArr) {
|
|
a(whereCondition);
|
|
this.b.add(whereCondition);
|
|
for (WhereCondition whereCondition2 : whereConditionArr) {
|
|
a(whereCondition2);
|
|
this.b.add(whereCondition2);
|
|
}
|
|
}
|
|
|
|
void a(WhereCondition whereCondition) {
|
|
if (whereCondition instanceof WhereCondition.PropertyCondition) {
|
|
a(((WhereCondition.PropertyCondition) whereCondition).d);
|
|
}
|
|
}
|
|
|
|
void a(Property property) {
|
|
AbstractDao<T, ?> abstractDao = this.a;
|
|
if (abstractDao != null) {
|
|
Property[] f = abstractDao.f();
|
|
int length = f.length;
|
|
boolean z = false;
|
|
int i = 0;
|
|
while (true) {
|
|
if (i >= length) {
|
|
break;
|
|
}
|
|
if (property == f[i]) {
|
|
z = true;
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
if (z) {
|
|
return;
|
|
}
|
|
throw new DaoException("Property '" + property.c + "' is not part of " + this.a);
|
|
}
|
|
}
|
|
|
|
void a(StringBuilder sb, String str, List<Object> list) {
|
|
ListIterator<WhereCondition> listIterator = this.b.listIterator();
|
|
while (listIterator.hasNext()) {
|
|
if (listIterator.hasPrevious()) {
|
|
sb.append(" AND ");
|
|
}
|
|
WhereCondition next = listIterator.next();
|
|
next.a(sb, str);
|
|
next.a(list);
|
|
}
|
|
}
|
|
|
|
boolean a() {
|
|
return this.b.isEmpty();
|
|
}
|
|
}
|