greendao源码分析:WhereCollector
2016-11-30 本文已影响80人
linheimx
WhereCollector 是什么?
- 它收集 WhereCondition
- 将收集的 WhereCondition 用 and 的方式加入 StringBuilder
- 提供便捷的方法结合多个条件为一个。
**1. 收集 WhereCondition **
将wherecondition
添加到 List<WhereCondition> whereConditions;
中
![](https://img.haomeiwen.com/i2596054/2e7bab177c1579c0.png)
**2. 将 WhereCondition 用 and 的方式加入 StringBuilder中 **
![](https://img.haomeiwen.com/i2596054/b9504aca17dc4907.png)
appendTo:
![](https://img.haomeiwen.com/i2596054/e78157cc5600ad9a.png)
appendValues:
![](https://img.haomeiwen.com/i2596054/63d73fe2a434625f.png)
WhereCondition
3. 集合多个条件
![](https://img.haomeiwen.com/i2596054/1d2a6a0e1b162a40.png)
谁在使用它? QueryBuilder
-
将多个条件以 and关系 加入 whereCollector
-
将多个条件以 or关系 加入 whereCollector
-
以or的关系创建WhereCondition:
-
以and的关系创建WhereCondition: