com.stackmob.sdk.api
Class StackMobOptions

java.lang.Object
  extended by com.stackmob.sdk.api.StackMobOptions

public class StackMobOptions
extends Object

stores the various options that can be passed into a request. At the moment this means select and expand options, as well as arbitrary headers to be passed along with the request


Constructor Summary
StackMobOptions()
           
 
Method Summary
static StackMobOptions depthOf(int depth)
          set the expand depth of objects being returned.
 int getExpandDepth()
          get the expand depth as set by withDepthOf(Integer)
static StackMobOptions header(String name, String value)
          add a single header to a request
static StackMobOptions headers(List<Map.Entry<String,String>> headers)
          add a list of headers to a request
static StackMobOptions headers(Map<String,String> headerMap)
          add a set of headers to a request
static StackMobOptions none()
          empty options that do nothing
static StackMobOptions selectedFields(List<String> fields)
          restricts the fields returned by a request.
 StackMobOptions withDepthOf(Integer i)
          set the expand depth of objects being returned.
 StackMobOptions withHeader(String name, String value)
          add a single header to a request
 StackMobOptions withHeaders(List<Map.Entry<String,String>> headers)
          add a list of headers to a request
 StackMobOptions withHeaders(Map<String,String> headerMap)
          add a set of headers to a request
 StackMobOptions withSelectedFields(List<String> fields)
          restricts the fields returned by a request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackMobOptions

public StackMobOptions()
Method Detail

none

public static StackMobOptions none()
empty options that do nothing

Returns:
options with nothing set.

header

public static StackMobOptions header(String name,
                                     String value)
add a single header to a request

Parameters:
name - the header name
value - the value of the header
Returns:
options with the new header set

headers

public static StackMobOptions headers(Map<String,String> headerMap)
add a set of headers to a request

Parameters:
headerMap - the headers to add
Returns:
options with the new headers set

headers

public static StackMobOptions headers(List<Map.Entry<String,String>> headers)
add a list of headers to a request

Parameters:
headers - the headers to add
Returns:
options with the new headers set

selectedFields

public static StackMobOptions selectedFields(List<String> fields)
restricts the fields returned by a request. This is only supported on get request, login, and getLoggedInUser

Parameters:
fields - the fields to return
Returns:
the new query that resulted from adding this operation

depthOf

public static StackMobOptions depthOf(int depth)
set the expand depth of objects being returned. Objects with relationships will have their related objects returned as child objects

Parameters:
depth - the expand depth, maximum is 3
Returns:
the new query that resulted from adding this operation

withHeader

public StackMobOptions withHeader(String name,
                                  String value)
add a single header to a request

Parameters:
name - the header name
value - the value of the header
Returns:
options with the new header set

withHeaders

public StackMobOptions withHeaders(Map<String,String> headerMap)
add a set of headers to a request

Parameters:
headerMap - the headers to add
Returns:
options with the new headers set

withHeaders

public StackMobOptions withHeaders(List<Map.Entry<String,String>> headers)
add a list of headers to a request

Parameters:
headers - the headers to add
Returns:
options with the new headers set

withSelectedFields

public StackMobOptions withSelectedFields(List<String> fields)
restricts the fields returned by a request. This is only supported on get request, login, and getLoggedInUser

Parameters:
fields - the fields to return
Returns:
the new query that resulted from adding this operation

withDepthOf

public StackMobOptions withDepthOf(Integer i)
set the expand depth of objects being returned. Objects with relationships will have their related objects returned as child objects

Parameters:
i - the expand depth, maximum is 3
Returns:
the new query that resulted from adding this operation

getExpandDepth

public int getExpandDepth()
get the expand depth as set by withDepthOf(Integer)

Returns:
the expand depth


Copyright © 2012 StackMob. All Rights Reserved.