public class AVQuery<T extends AVObject> extends Object implements Cloneable
| 限定符和类型 | 类和说明 |
|---|---|
static class |
AVQuery.CachePolicy |
| 限定符和类型 | 方法和说明 |
|---|---|
AVQuery<T> |
addAscendingOrder(String key)
Also sorts the results in ascending order by the given key.
|
AVQuery<T> |
addDescendingOrder(String key)
Also sorts the results in descending order by the given key.
|
protected AVQuery<T> |
addWhereItem(String key,
String op,
Object value) |
static <T extends AVObject> |
and(List<AVQuery<T>> queries)
Constructs a query that is the and of the given queries.
|
protected Map<String,Object> |
assembleJsonParam() |
Map<String,String> |
assembleParameters()
Assemble query parameters.
|
static void |
clearAllCachedResults()
Clears the cached result for all queries.
|
void |
clearCachedResult()
Removes the previously cached result for this query, forcing the next find() to hit the
network.
|
AVQuery |
clone()
Clone a new query object, which fully same to this.
|
int |
count()
Get result count in blocking mode.
|
io.reactivex.Observable<Integer> |
countInBackground()
Get result count in async mode.
|
void |
deleteAll()
Delete all query result in blocking mode.
|
io.reactivex.Observable<AVNull> |
deleteAllInBackground()
Delete all query result in async mode.
|
static io.reactivex.Observable<AVCloudQueryResult> |
doCloudQueryInBackground(String cql)
Do cloud query in async mode.
|
static io.reactivex.Observable<AVCloudQueryResult> |
doCloudQueryInBackground(String cql,
Class<? extends AVObject> clazz)
Do cloud query in async mode.
|
static io.reactivex.Observable<AVCloudQueryResult> |
doCloudQueryInBackground(String cql,
Class<? extends AVObject> clazz,
Object... params)
Do cloud query in async mode.
|
static io.reactivex.Observable<AVCloudQueryResult> |
doCloudQueryInBackground(String cql,
Object... params)
Do cloud query in async mode.
|
List<T> |
find()
Execute query in blocking mode.
|
io.reactivex.Observable<List<T>> |
findInBackground()
Execute query in async mode.
|
protected io.reactivex.Observable<List<T>> |
findInBackground(int explicitLimit) |
T |
get(String objectId)
Get Object with specified objectId in blocking mode.
|
AVQuery.CachePolicy |
getCachePolicy()
Accessor for the caching policy.
|
String |
getClassName()
Get class name
|
T |
getFirst()
Get first result in blocking mode.
|
io.reactivex.Observable<T> |
getFirstInBackground()
Get first result in async mode.
|
io.reactivex.Observable<T> |
getInBackground(String objectId)
Get Object with specified objectId in async mode.
|
int |
getLimit()
Accessor for the limit.
|
long |
getMaxCacheAge()
Gets the maximum age of cached data that will be considered in this query.
|
String |
getOrder()
Get order string.
|
AVQuery.CachePolicy |
getPolicy()
Get cache policy.
|
static <T extends AVObject> |
getQuery(Class<T> clazz)
Create a AVQuery with special sub-class.
|
static <T extends AVObject> |
getQuery(String theClassName)
Constructs a query.
|
int |
getSkip()
Accessor for the skip value.
|
boolean |
hasCachedResult()
Has cached result or not.
|
AVQuery<T> |
include(String key)
Include nested AVObjects for the provided key.
|
AVQuery<T> |
includeACL(boolean includeACL)
set include ACL or not.
|
boolean |
isIncludeACL()
Flag to indicate need ACL returned in result.
|
AVQuery<T> |
limit(int limit) |
static <T extends AVObject> |
or(List<AVQuery<T>> queries)
Constructs a query that is the or of the given queries.
|
AVQuery<T> |
order(String order) |
AVQuery<T> |
orderByAscending(String key)
Sorts the results in ascending order by the given key.
|
AVQuery<T> |
orderByDescending(String key)
Sorts the results in descending order by the given key.
|
AVQuery<T> |
selectKeys(Collection<String> keys)
Restrict the fields of returned AVObjects to only include the provided keys.
|
AVQuery<T> |
setCachePolicy(AVQuery.CachePolicy cachePolicy)
Change the caching policy of this query.
|
AVQuery<T> |
setClassName(String className)
Set class name
|
AVQuery<T> |
setLimit(int limit)
Controls the maximum number of results that are returned.
|
AVQuery<T> |
setMaxCacheAge(long maxCacheAge)
Sets the maximum age of cached data that will be considered in this query.
|
AVQuery<T> |
setOrder(String order)
Set query order fields.
|
AVQuery<T> |
setPolicy(AVQuery.CachePolicy policy)
Change the caching policy of this query.
|
AVQuery<T> |
setSkip(int skip)
Controls the number of results to skip before returning any results.
|
AVQuery<T> |
skip(int skip) |
AVQuery<T> |
whereContainedIn(String key,
Collection<? extends Object> values)
Add a constraint to the query that requires a particular key's value to be contained in the
provided list of values.
|
AVQuery<T> |
whereContains(String key,
String substring)
Add a constraint for finding string values that contain a provided string.
|
AVQuery<T> |
whereContainsAll(String key,
Collection<?> values)
Add a constraint to the query that requires a particular key's value match another AVQuery.
|
AVQuery<T> |
whereDoesNotExist(String key)
Add a constraint for finding objects that do not contain a given key.
|
AVQuery<T> |
whereDoesNotMatchKeyInQuery(String key,
String keyInQuery,
AVQuery<?> query)
Add a constraint to the query that requires a particular key's value does not match any value
for a key in the results of another AVQuery.
|
AVQuery<T> |
whereDoesNotMatchQuery(String key,
AVQuery<?> query)
Add a constraint to the query that requires a particular key's value does not match another
AVQuery.
|
AVQuery<T> |
whereEndsWith(String key,
String suffix)
Add a constraint for finding string values that end with a provided string.
|
AVQuery<T> |
whereEqualTo(String key,
Object value)
Add a constraint to the query that requires a particular key's value to be equal to the
provided value.
|
AVQuery<T> |
whereExists(String key)
Add a constraint for finding objects that contain the given key.
|
AVQuery<T> |
whereGreaterThan(String key,
Object value)
Add a constraint to the query that requires a particular key's value to be greater than the
provided value.
w
|
AVQuery<T> |
whereGreaterThanOrEqualTo(String key,
Object value)
Add a constraint to the query that requires a particular key's value to be greater or equal to
than the provided value.
|
AVQuery<T> |
whereLessThan(String key,
Object value)
Add a constraint to the query that requires a particular key's value to be less than the
provided value.
|
AVQuery<T> |
whereLessThanOrEqualTo(String key,
Object value)
Add a constraint to the query that requires a particular key's value to be less or equal to
than the provided value.
|
AVQuery<T> |
whereMatches(String key,
String regex)
Add a regular expression constraint for finding string values that match the provided regular
expression.
|
AVQuery<T> |
whereMatches(String key,
String regex,
String modifiers)
Add a regular expression constraint for finding string values that match the provided regular
expression.
|
AVQuery<T> |
whereMatchesKeyInQuery(String key,
String keyInQuery,
AVQuery<?> query)
Add a constraint to the query that requires a particular key's value matches a value for a key
in the results of another AVQuery
|
AVQuery<T> |
whereMatchesQuery(String key,
AVQuery<?> query)
Add a constraint to the query that requires a particular key's value match another AVQuery.
|
AVQuery<T> |
whereNear(String key,
AVGeoPoint point)
Add a proximity based constraint for finding objects with key point values near the point
given.
|
AVQuery<T> |
whereNotContainedIn(String key,
Collection<? extends Object> values)
Add a constraint to the query that requires a particular key's value not be contained in the
provided list of values.
|
AVQuery<T> |
whereNotEqualTo(String key,
Object value)
Add a constraint to the query that requires a particular key's value to be not equal to the
provided value.
|
AVQuery<T> |
whereSizeEqual(String key,
int size)
添加查询约束条件,查找key类型是数组,该数组的长度匹配提供的数值。
|
AVQuery<T> |
whereStartsWith(String key,
String prefix)
Add a constraint for finding string values that start with a provided string.
|
AVQuery<T> |
whereWithinGeoBox(String key,
AVGeoPoint southwest,
AVGeoPoint northeast)
Add a constraint to the query that requires a particular key's coordinates be contained within
a given rectangular geographic bounding box.
|
AVQuery<T> |
whereWithinKilometers(String key,
AVGeoPoint point,
double maxDistance)
Add a proximity based constraint for finding objects with key point values near the point given
and within the maximum distance given.
|
AVQuery<T> |
whereWithinKilometers(String key,
AVGeoPoint point,
double maxDistance,
double minDistance)
Add a proximity based constraint for finding objects with key point values near the point given
and within the given ring area
Radius of earth used is 6371.0 kilometers.
|
AVQuery<T> |
whereWithinMiles(String key,
AVGeoPoint point,
double maxDistance)
Add a proximity based constraint for finding objects with key point values near the point given
and within the maximum distance given.
|
AVQuery<T> |
whereWithinMiles(String key,
AVGeoPoint point,
double maxDistance,
double minDistance)
Add a proximity based constraint for finding objects with key point values near the point
given and within the given ring.
|
AVQuery<T> |
whereWithinRadians(String key,
AVGeoPoint point,
double maxDistance)
Add a proximity based constraint for finding objects with key point values near the point given
and within the maximum distance given.
|
AVQuery<T> |
whereWithinRadians(String key,
AVGeoPoint point,
double maxDistance,
double minDistance)
Add a proximity based constraint for finding objects with key point values near the point given
and within the maximum distance given.
|
public AVQuery(String theClassName)
theClassName - The name of the class to retrieve AVObjects for.public AVQuery clone() throws CloneNotSupportedException
clone 在类中 ObjectCloneNotSupportedExceptionpublic static <T extends AVObject> AVQuery<T> getQuery(String theClassName)
T - template type.theClassName - The name of the class to retrieve AVObjects for.public static <T extends AVObject> AVQuery<T> getQuery(Class<T> clazz)
T - template type.clazz - The AVObject subclasspublic String getClassName()
public AVQuery<T> setClassName(String className)
className - class name.public AVQuery.CachePolicy getCachePolicy()
public AVQuery<T> setCachePolicy(AVQuery.CachePolicy cachePolicy)
cachePolicy - cache policy.public AVQuery.CachePolicy getPolicy()
public AVQuery<T> setPolicy(AVQuery.CachePolicy policy)
policy - cache policy.public long getMaxCacheAge()
public AVQuery<T> setMaxCacheAge(long maxCacheAge)
maxCacheAge - mac cached age.public static void clearAllCachedResults()
public void clearCachedResult()
public int getLimit()
public AVQuery<T> setLimit(int limit)
limit - query limit.public AVQuery<T> limit(int limit)
limit - query limitsetLimit(int)public AVQuery<T> skip(int skip)
skip - qury skipsetSkip(int)public int getSkip()
public AVQuery<T> setSkip(int skip)
skip - query skip.public String getOrder()
public AVQuery<T> setOrder(String order)
order - order string.public AVQuery<T> order(String order)
order - order string.setOrder(String)public AVQuery<T> addAscendingOrder(String key)
key - The key to order bypublic AVQuery<T> addDescendingOrder(String key)
key - The key to order bypublic boolean isIncludeACL()
public AVQuery<T> includeACL(boolean includeACL)
includeACL - Flag to indicate need ACL returned in result.public AVQuery<T> include(String key)
key - The key that should be included.public AVQuery<T> selectKeys(Collection<String> keys)
keys - The set of keys to include in the result.public AVQuery<T> orderByAscending(String key)
key - The key to order by.public AVQuery<T> orderByDescending(String key)
key - The key to order by.public AVQuery<T> whereContainedIn(String key, Collection<? extends Object> values)
key - The key to check.values - The values that will match.public AVQuery<T> whereContains(String key, String substring)
key - The key that the string to match is stored in.substring - The substring that the value must contain.public AVQuery<T> whereSizeEqual(String key, int size)
key - 查询的keysize - 数组的长度public AVQuery<T> whereContainsAll(String key, Collection<?> values)
key - The key to check. This key's value must be an array.values - The values that will match.public AVQuery<T> whereDoesNotExist(String key)
key - The key that should not existpublic AVQuery<T> whereEndsWith(String key, String suffix)
key - The key that the string to match is stored in.suffix - The substring that the value must end with.public AVQuery<T> whereEqualTo(String key, Object value)
key - The key to check.value - The value that the AVObject must contain.public AVQuery<T> whereExists(String key)
key - The key that should exist.public AVQuery<T> whereGreaterThan(String key, Object value)
key - The key to check.value - The value that provides an lower bound.public AVQuery<T> whereGreaterThanOrEqualTo(String key, Object value)
key - The key to check.value - The value that provides an lower bound.public AVQuery<T> whereLessThan(String key, Object value)
key - The key to check.value - The value that provides an upper bound.public AVQuery<T> whereLessThanOrEqualTo(String key, Object value)
key - The key to check.value - The value that provides an lower bound.public AVQuery<T> whereMatches(String key, String regex)
key - The key that the string to match is stored in.regex - The regular expression pattern to match.public AVQuery<T> whereMatches(String key, String regex, String modifiers)
key - The key that the string to match is stored in.regex - The regular expression pattern to match.modifiers - Any of the following supported PCRE modifiers: i - Case insensitive search m -
Search across multiple lines of inputpublic AVQuery<T> whereNear(String key, AVGeoPoint point)
key - The key that the AVGeoPoint is stored in.point - The reference AVGeoPoint that is used.public AVQuery<T> whereNotContainedIn(String key, Collection<? extends Object> values)
key - The key to check.values - The values that will not match.public AVQuery<T> whereNotEqualTo(String key, Object value)
key - The key to check.value - The value that must not be equalled.public AVQuery<T> whereStartsWith(String key, String prefix)
key - The key that the string to match is stored in.prefix - The substring that the value must start with.public AVQuery<T> whereWithinGeoBox(String key, AVGeoPoint southwest, AVGeoPoint northeast)
key - The key to be constrained.southwest - The lower-left inclusive corner of the box.northeast - The upper-right inclusive corner of the box.public AVQuery<T> whereWithinKilometers(String key, AVGeoPoint point, double maxDistance)
key - The key that the AVGeoPoint is stored in.point - The reference AVGeoPoint that is used.maxDistance - Maximum distance (in kilometers) of results to return.public AVQuery<T> whereWithinKilometers(String key, AVGeoPoint point, double maxDistance, double minDistance)
key - The key that the AVGeoPoint is stored in.point - The reference AVGeoPoint that is used.maxDistance - outer radius of the given ring in kilometersminDistance - inner radius of the given ring in kilometerspublic AVQuery<T> whereWithinMiles(String key, AVGeoPoint point, double maxDistance)
key - The key that the AVGeoPoint is stored in.maxDistance - outer radius of the given ring in miles.point - The reference AVGeoPoint that is used.public AVQuery<T> whereWithinMiles(String key, AVGeoPoint point, double maxDistance, double minDistance)
key - The key that the AVGeoPoint is stored in.point - The reference AVGeoPoint that is used.maxDistance - outer radius of the given ring in miles.minDistance - inner radius of the given ring in miles.public AVQuery<T> whereWithinRadians(String key, AVGeoPoint point, double maxDistance)
key - The key that the AVGeoPoint is stored in.point - The reference AVGeoPoint that is used.maxDistance - Maximum distance (in radians) of results to return.public AVQuery<T> whereWithinRadians(String key, AVGeoPoint point, double maxDistance, double minDistance)
key - The key that the AVGeoPoint is stored in.point - The reference AVGeoPoint that is used.maxDistance - outer radius of the given radians.minDistance - inner radius of the given radians.public AVQuery<T> whereMatchesKeyInQuery(String key, String keyInQuery, AVQuery<?> query)
key - The key whose value is being checkedkeyInQuery - The key in the objects from the sub query to look inquery - The sub query to runpublic AVQuery<T> whereMatchesQuery(String key, AVQuery<?> query)
key - The key to check.query - The query that the value should matchpublic AVQuery<T> whereDoesNotMatchKeyInQuery(String key, String keyInQuery, AVQuery<?> query)
key - The key whose value is being checked and excludedkeyInQuery - The key in the objects from the sub query to look inquery - The sub query to runpublic AVQuery<T> whereDoesNotMatchQuery(String key, AVQuery<?> query)
key - The key to check.query - The query that the value should not matchpublic static <T extends AVObject> AVQuery<T> or(List<AVQuery<T>> queries)
T - template type.queries - The list of AVQueries to 'or' togetherpublic static <T extends AVObject> AVQuery<T> and(List<AVQuery<T>> queries)
T - template type.queries - The list of AVQueries to 'and' togetherpublic boolean hasCachedResult()
public io.reactivex.Observable<List<T>> findInBackground()
public T get(String objectId)
objectId - object id.public io.reactivex.Observable<T> getInBackground(String objectId)
objectId - object id.public T getFirst()
public io.reactivex.Observable<T> getFirstInBackground()
public int count()
public io.reactivex.Observable<Integer> countInBackground()
public void deleteAll()
public io.reactivex.Observable<AVNull> deleteAllInBackground()
public Map<String,String> assembleParameters()
public static io.reactivex.Observable<AVCloudQueryResult> doCloudQueryInBackground(String cql)
cql - cql stringpublic static io.reactivex.Observable<AVCloudQueryResult> doCloudQueryInBackground(String cql, Object... params)
cql - cql stringparams - query parameters.public static io.reactivex.Observable<AVCloudQueryResult> doCloudQueryInBackground(String cql, Class<? extends AVObject> clazz)
cql - cql stringclazz - result class.public static io.reactivex.Observable<AVCloudQueryResult> doCloudQueryInBackground(String cql, Class<? extends AVObject> clazz, Object... params)
cql - cql stringclazz - result class.params - query parameters.Copyright © 2020, 美味书签(北京)信息技术有限公司 All rights reserved.