|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.stackmob.sdk.api.StackMobQuery
public class StackMobQuery
A class that builds queries to execute on the StackMob platform. Example usage:
//this code:
StackMobQuery query = new StackMobQuery("user").field("age").isGreaterThan(20).isLessThanOrEqualTo(40).field("friend").in(Arrays.asList("joe", "bob", "alice").getQuery();
//is identical to this code:
StackMobQuery query = new StackMobQuery("user").fieldIsGreaterThan("user", 20).fieldIsLessThanOrEqualTo("user", 40).fieldIsIn("user", Arrays.asList("joe", "bob", "alice");
A few helpful notes about this object:
| Nested Class Summary | |
|---|---|
static class |
StackMobQuery.Operator
|
static class |
StackMobQuery.Ordering
|
| Constructor Summary | |
|---|---|
StackMobQuery(String objectName)
|
|
| Method Summary | |
|---|---|
StackMobQuery |
add(StackMobQuery other)
|
StackMobQuery |
expandDepthIs(Integer i)
set the expand depth of this query. |
StackMobQueryWithField |
field(String field)
|
StackMobQuery |
fieldIsEqualTo(String field,
String val)
add an "=" to your query. |
StackMobQuery |
fieldIsGreaterThan(String field,
String val)
same as fieldIsLessThan(String, String), except applies ">" instead of "<" |
StackMobQuery |
fieldIsGreaterThanOrEqualTo(String field,
String val)
same as fieldIsLessThan(String, String), except applies ">=" instead of "<" |
StackMobQuery |
fieldIsIn(String field,
List<String> values)
add an "IN" to your query. |
StackMobQuery |
fieldIsLessThan(String field,
String val)
same as fieldIsLessThan(String, String), except works with Strings |
StackMobQuery |
fieldIslessThanOrEqualTo(String field,
String val)
same as fieldIsLessThan(String, String), except applies "<=" instead of "<" |
StackMobQuery |
fieldIsNear(String field,
GeoPoint point)
add a "NEAR" to your query for the given GeoPoint field. |
StackMobQuery |
fieldIsNearWithinKm(String field,
GeoPoint point,
Double maxDistanceKm)
add a "NEAR" to your query for the given GeoPoint field. |
StackMobQuery |
fieldIsNearWithinMi(String field,
GeoPoint point,
Double maxDistanceMi)
add a "NEAR" to your query for the given GeoPoint field. |
StackMobQuery |
fieldIsNotEqual(String field,
String val)
add a "NE" to your query. |
StackMobQuery |
fieldIsNotNull(String field)
add a "NULL" to your query. |
StackMobQuery |
fieldIsNull(String field)
add a "NULL" to your query. |
StackMobQuery |
fieldIsOrderedBy(String field,
StackMobQuery.Ordering ordering)
add an "ORDER BY" to your query |
StackMobQuery |
fieldIsWithinBox(String field,
GeoPoint lowerLeft,
GeoPoint upperRight)
add a "WITHIN" to your query for the given GeoPoint field. |
StackMobQuery |
fieldIsWithinRadiusInKm(String field,
GeoPoint point,
Double radiusInKm)
add a "WITHIN" to your query for the given GeoPoint field. |
StackMobQuery |
fieldIsWithinRadiusInMi(String field,
GeoPoint point,
Double radiusInMi)
add a "WITHIN" to your query for the given GeoPoint field. |
Map<String,String> |
getArguments()
|
Map<String,String> |
getHeaders()
|
String |
getObjectName()
|
StackMobQuery |
isInRange(Integer start)
same thing as isInRange(Integer, Integer), except does not specify an end to the range. |
StackMobQuery |
isInRange(Integer start,
Integer end)
this method lets you add a "LIMIT" and "SKIP" to your query at once. |
static StackMobQuery |
objects(String objectName)
|
StackMobQuery |
select(List<String> fields)
restricts the fields returned in the query |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StackMobQuery(String objectName)
| Method Detail |
|---|
public static StackMobQuery objects(String objectName)
public String getObjectName()
public Map<String,String> getHeaders()
public Map<String,String> getArguments()
public StackMobQuery add(StackMobQuery other)
public StackMobQueryWithField field(String field)
public StackMobQuery fieldIsNear(String field,
GeoPoint point)
field - the GeoPoint field whose value to testpoint - the lon/lat location to center the search
public StackMobQuery fieldIsNearWithinMi(String field,
GeoPoint point,
Double maxDistanceMi)
field - the GeoPoint field whose value to testpoint - the lon/lat location to center the searchmaxDistanceMi - the maximum distance in miles a matched field can be from point.
public StackMobQuery fieldIsNearWithinKm(String field,
GeoPoint point,
Double maxDistanceKm)
field - the GeoPoint field whose value to testpoint - the lon/lat location to center the searchmaxDistanceKm - the maximum distance in kilometers a matched field can be from point.
public StackMobQuery fieldIsWithinRadiusInMi(String field,
GeoPoint point,
Double radiusInMi)
field - the GeoPoint field whose value to testpoint - the lon/lat location to center the searchradiusInMi - the maximum distance in miles a matched field can be from point.
public StackMobQuery fieldIsWithinRadiusInKm(String field,
GeoPoint point,
Double radiusInKm)
field - the GeoPoint field whose value to testpoint - the lon/lat location to center the searchradiusInKm - the maximum distance in kilometers a matched field can be from point.
public StackMobQuery fieldIsWithinBox(String field,
GeoPoint lowerLeft,
GeoPoint upperRight)
field - the GeoPoint field whose value to testlowerLeft - the lon/lat location of the lower left corner of the bounding boxupperRight - the lon/lat location of the upper right corner of the bounding box
public StackMobQuery fieldIsIn(String field,
List<String> values)
field - the field whose value to testvalues - the values against which to match
public StackMobQuery fieldIsNotEqual(String field,
String val)
field - the field whose value to testval - the value against which to match
public StackMobQuery fieldIsNull(String field)
field - the field whose value to test
public StackMobQuery fieldIsNotNull(String field)
field - the field whose value to test
public StackMobQuery fieldIsLessThan(String field,
String val)
fieldIsLessThan(String, String), except works with Strings
field - the field whose value to testval - the value against which to test
public StackMobQuery fieldIslessThanOrEqualTo(String field,
String val)
fieldIsLessThan(String, String), except applies "<=" instead of "<"
field - the field whose value to testval - the value against which to test
public StackMobQuery fieldIsGreaterThan(String field,
String val)
fieldIsLessThan(String, String), except applies ">" instead of "<"
field - the field whose value to testval - the value against which to test
public StackMobQuery fieldIsGreaterThanOrEqualTo(String field,
String val)
fieldIsLessThan(String, String), except applies ">=" instead of "<"
field - the field whose value to testval - the value against which to test
public StackMobQuery fieldIsEqualTo(String field,
String val)
field - the field whose value to testval - the value against which to test
public StackMobQuery fieldIsOrderedBy(String field,
StackMobQuery.Ordering ordering)
field - the field to order byordering - the ordering of that field
public StackMobQuery expandDepthIs(Integer i)
i - the expand depth. at time of writing, StackMob restricts expand depth to maximum 3
public StackMobQuery isInRange(Integer start,
Integer end)
start - the starting object number (inclusive)end - the ending object number (inclusive)
public StackMobQuery isInRange(Integer start)
isInRange(Integer, Integer), except does not specify an end to the range.
instead, gets all objects from a starting point (including)
start - the starting object number
public StackMobQuery select(List<String> fields)
fields - the fields to return
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||