com.stackmob.sdk.model
Class StackMobModelQuery<T extends StackMobModel>

java.lang.Object
  extended by com.stackmob.sdk.model.StackMobModelQuery<T>

public class StackMobModelQuery<T extends StackMobModel>
extends java.lang.Object


Constructor Summary
StackMobModelQuery(java.lang.Class<T> classOfT)
           
 
Method Summary
 StackMobModelQuery<T> expandDepthIs(java.lang.Integer i)
          set the expand depth of this query.
 StackMobModelQuery<T> field(StackMobField fieldObj)
           
 StackMobModelQuery<T> fieldIsEqualTo(java.lang.String field, java.lang.String val)
          add an "=" to your query.
 StackMobModelQuery<T> fieldIsGreaterThan(java.lang.String field, java.lang.String val)
          same as fieldIsLessThan(String, String), except applies ">" instead of "<"
 StackMobModelQuery<T> fieldIsGreaterThanOrEqualTo(java.lang.String field, java.lang.String val)
          same as fieldIsLessThan(String, String), except applies ">=" instead of "<"
 StackMobModelQuery<T> fieldIsIn(java.lang.String field, java.util.List<java.lang.String> values)
          add an "IN" to your query.
 StackMobModelQuery<T> fieldIsLessThan(java.lang.String field, java.lang.String val)
          same as fieldIsLessThan(String, String), except works with Strings
 StackMobModelQuery<T> fieldIsLessThanOrEqualTo(java.lang.String field, java.lang.String val)
          same as fieldIsLessThan(String, String), except applies "<=" instead of "<"
 StackMobModelQuery<T> fieldIsNear(java.lang.String field, GeoPoint point)
          add a "NEAR" to your query for the given GeoPoint field.
 StackMobModelQuery<T> fieldIsNearWithinKm(java.lang.String field, GeoPoint point, java.lang.Double maxDistanceKm)
          add a "NEAR" to your query for the given GeoPoint field.
 StackMobModelQuery<T> fieldIsNearWithinMi(java.lang.String field, GeoPoint point, java.lang.Double maxDistanceMi)
          add a "NEAR" to your query for the given GeoPoint field.
 StackMobModelQuery<T> fieldIsOrderedBy(java.lang.String field, StackMobQuery.Ordering ordering)
          add an "ORDER BY" to your query
 StackMobModelQuery<T> fieldIsWithinBox(java.lang.String field, GeoPoint lowerLeft, GeoPoint upperRight)
          add a "WITHIN" to your query for the given GeoPoint field.
 StackMobModelQuery<T> fieldIsWithinRadiusInKm(java.lang.String field, GeoPoint point, java.lang.Double radiusInKm)
          add a "WITHIN" to your query for the given GeoPoint field.
 StackMobModelQuery<T> fieldIsWithinRadiusInMi(java.lang.String field, GeoPoint point, java.lang.Double radiusInMi)
          add a "WITHIN" to your query for the given GeoPoint field.
 StackMobQuery getQuery()
           
 StackMobModelQuery<T> isInRange(java.lang.Integer start)
          same thing as isInRange(Integer, Integer), except does not specify an end to the range.
 StackMobModelQuery<T> isInRange(java.lang.Integer start, java.lang.Integer end)
          this method lets you add a "LIMIT" and "SKIP" to your query at once.
 StackMobModelQuery<T> select(java.util.List<java.lang.String> fields)
          restricts the fields returned in the query
 void send(StackMobQueryCallback<T> callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackMobModelQuery

public StackMobModelQuery(java.lang.Class<T> classOfT)
Method Detail

getQuery

public StackMobQuery getQuery()

send

public void send(StackMobQueryCallback<T> callback)

field

public StackMobModelQuery<T> field(StackMobField fieldObj)

fieldIsNear

public StackMobModelQuery<T> fieldIsNear(java.lang.String field,
                                         GeoPoint point)
add a "NEAR" to your query for the given GeoPoint field. Query results are automatically returned sorted by distance closest to the queried point

Parameters:
field - the GeoPoint field whose value to test
point - the lon/lat location to center the search
Returns:
the new query that resulted from adding this operation

fieldIsNearWithinMi

public StackMobModelQuery<T> fieldIsNearWithinMi(java.lang.String field,
                                                 GeoPoint point,
                                                 java.lang.Double maxDistanceMi)
add a "NEAR" to your query for the given GeoPoint field. Query results are automatically returned sorted by distance closest to the queried point

Parameters:
field - the GeoPoint field whose value to test
point - the lon/lat location to center the search
maxDistanceMi - the maximum distance in miles a matched field can be from point.
Returns:
the new query that resulted from adding this operation

fieldIsNearWithinKm

public StackMobModelQuery<T> fieldIsNearWithinKm(java.lang.String field,
                                                 GeoPoint point,
                                                 java.lang.Double maxDistanceKm)
add a "NEAR" to your query for the given GeoPoint field. Query results are automatically returned sorted by distance closest to the queried point

Parameters:
field - the GeoPoint field whose value to test
point - the lon/lat location to center the search
maxDistanceKm - the maximum distance in kilometers a matched field can be from point.
Returns:
the new query that resulted from adding this operation

fieldIsWithinRadiusInMi

public StackMobModelQuery<T> fieldIsWithinRadiusInMi(java.lang.String field,
                                                     GeoPoint point,
                                                     java.lang.Double radiusInMi)
add a "WITHIN" to your query for the given GeoPoint field. Query results are not sorted by distance.

Parameters:
field - the GeoPoint field whose value to test
point - the lon/lat location to center the search
radiusInMi - the maximum distance in miles a matched field can be from point.
Returns:
the new query that resulted from adding this operation

fieldIsWithinRadiusInKm

public StackMobModelQuery<T> fieldIsWithinRadiusInKm(java.lang.String field,
                                                     GeoPoint point,
                                                     java.lang.Double radiusInKm)
add a "WITHIN" to your query for the given GeoPoint field. Query results are not sorted by distance.

Parameters:
field - the GeoPoint field whose value to test
point - the lon/lat location to center the search
radiusInKm - the maximum distance in kilometers a matched field can be from point.
Returns:
the new query that resulted from adding this operation

fieldIsWithinBox

public StackMobModelQuery<T> fieldIsWithinBox(java.lang.String field,
                                              GeoPoint lowerLeft,
                                              GeoPoint upperRight)
add a "WITHIN" to your query for the given GeoPoint field. Matched fields will be within the 2-dimensional bounds defined by the lowerLeft and upperRight GeoPoints given

Parameters:
field - the GeoPoint field whose value to test
lowerLeft - the lon/lat location of the lower left corner of the bounding box
upperRight - the lon/lat location of the upper right corner of the bounding box
Returns:
the new query that resulted from adding this operation

fieldIsIn

public StackMobModelQuery<T> fieldIsIn(java.lang.String field,
                                       java.util.List<java.lang.String> values)
add an "IN" to your query. test whether the given field's value is in the given list of possible values

Parameters:
field - the field whose value to test
values - the values against which to match
Returns:
the new query that resulted from adding this operation

fieldIsLessThan

public StackMobModelQuery<T> fieldIsLessThan(java.lang.String field,
                                             java.lang.String val)
same as fieldIsLessThan(String, String), except works with Strings

Parameters:
field - the field whose value to test
val - the value against which to test
Returns:
the new query that resulted from adding this operation

fieldIsLessThanOrEqualTo

public StackMobModelQuery<T> fieldIsLessThanOrEqualTo(java.lang.String field,
                                                      java.lang.String val)
same as fieldIsLessThan(String, String), except applies "<=" instead of "<"

Parameters:
field - the field whose value to test
val - the value against which to test
Returns:
the new query that resulted from adding this operation

fieldIsGreaterThan

public StackMobModelQuery<T> fieldIsGreaterThan(java.lang.String field,
                                                java.lang.String val)
same as fieldIsLessThan(String, String), except applies ">" instead of "<"

Parameters:
field - the field whose value to test
val - the value against which to test
Returns:
the new query that resulted from adding this operation

fieldIsGreaterThanOrEqualTo

public StackMobModelQuery<T> fieldIsGreaterThanOrEqualTo(java.lang.String field,
                                                         java.lang.String val)
same as fieldIsLessThan(String, String), except applies ">=" instead of "<"

Parameters:
field - the field whose value to test
val - the value against which to test
Returns:
the new query that resulted from adding this operation

fieldIsEqualTo

public StackMobModelQuery<T> fieldIsEqualTo(java.lang.String field,
                                            java.lang.String val)
add an "=" to your query. test whether the given field's value is equal to the given value

Parameters:
field - the field whose value to test
val - the value against which to test
Returns:
the new query that resulted from adding this operation

fieldIsOrderedBy

public StackMobModelQuery<T> fieldIsOrderedBy(java.lang.String field,
                                              StackMobQuery.Ordering ordering)
add an "ORDER BY" to your query

Parameters:
field - the field to order by
ordering - the ordering of that field
Returns:
the new query that resulted from adding this operation

expandDepthIs

public StackMobModelQuery<T> expandDepthIs(java.lang.Integer i)
set the expand depth of this query. the expand depth instructs the StackMob platform to detect relationships and automatically replace those relationship IDs with the values that they point to.

Parameters:
i - the expand depth. at time of writing, StackMob restricts expand depth to maximum 3
Returns:
the new query that resulted from adding this operation

isInRange

public StackMobModelQuery<T> isInRange(java.lang.Integer start,
                                       java.lang.Integer end)
this method lets you add a "LIMIT" and "SKIP" to your query at once. Can be used to implement pagination in your app.

Parameters:
start - the starting object number (inclusive)
end - the ending object number (inclusive)
Returns:
the new query that resulted from adding this operation

isInRange

public StackMobModelQuery<T> isInRange(java.lang.Integer start)
same thing as isInRange(Integer, Integer), except does not specify an end to the range. instead, gets all objects from a starting point (including)

Parameters:
start - the starting object number
Returns:
the new query that resulted from adding this operation

select

public StackMobModelQuery<T> select(java.util.List<java.lang.String> fields)
restricts the fields returned in the query

Parameters:
fields - the fields to return
Returns:


Copyright © 2012 StackMob. All Rights Reserved.