本文整理匯總了Java中com.parse.ParseQuery.whereLessThanOrEqualTo方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseQuery.whereLessThanOrEqualTo方法的具體用法?Java ParseQuery.whereLessThanOrEqualTo怎麽用?Java ParseQuery.whereLessThanOrEqualTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.whereLessThanOrEqualTo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Build
import com.parse.ParseQuery; //導入方法依賴的package包/類
public static ParseQuery Build(String className, HashMap[] conditions) {
ParseQuery<ParseObject> query = new ParseQuery(className);
// Create a composite query via chaining
for (int i = 0; i < conditions.length; ++i) {
HashMap map = conditions[i];
// These fields must be named exactly the same in the calling application
String key = (String)map.get("key");
String condition = (String)map.get("condition");
Object value = map.get("value");
if (HasValidConditions(map)) {
// This sucks, but I don't really want to try to be clever and use
// reflection to map conditions to method names. It's not by any means
// a complete implementation, as it only contains condition matching
// for basic operations.
if (condition.equals("==")) {
query = query.whereEqualTo(key, value);
}
else if (condition.equals("!=")) {
query = query.whereNotEqualTo(key, value);
}
else if (condition.equals(">")) {
query = query.whereGreaterThan(key, value);
}
else if (condition.equals("<")) {
query = query.whereLessThan(key, value);
}
else if (condition.equals(">=")) {
query = query.whereGreaterThanOrEqualTo(key, value);
}
else if (condition.equals("<=")) {
query = query.whereLessThanOrEqualTo(key, value);
}
else if (condition.equals("exists")) {
query = query.whereExists(key);
}
else if (condition.equals("notexists")) {
query = query.whereDoesNotExist(key);
}
else if (condition.equals("orderby")) {
if (value.equals("asc")) {
query = query.orderByAscending(key);
}
else if (value.equals("desc")) {
query = query.orderByDescending(key);
}
else {
Log.e(TAG, "Unrecognized sorting order, use 'asc' or 'desc'.");
}
}
else {
Log.e(TAG, "The condition '"+ condition + "' was not recognized by " +
"the module. Create a request for implementation on GitHub, or " +
"implemented it and create a pull request.");
}
}
}
return query;
}
示例2: getSnacks
import com.parse.ParseQuery; //導入方法依賴的package包/類
/**
* Fetches the list of snack entries for a user using an explicit lower and upper bound
* on the createdAt field.
*
* @param user Which user's entries to fetch.
* @param lowerBound The lower bound on the createdAt date.
* @param upperBound The upper bound on the createdAt date.
* @param callback The callback to invoke upon completion.
*/
private static void getSnacks(ParseUser user, Date lowerBound, Date upperBound, FindCallback<SnackEntry> callback){
ParseQuery<SnackEntry> query = new ParseQuery<>(SnackEntry.class);
query.whereEqualTo("owner", user);
query.whereGreaterThanOrEqualTo("createdAt", lowerBound);
query.whereLessThanOrEqualTo("createdAt", upperBound);
query.findInBackground(callback);
}