public class

KinveyReference

extends GenericJson
java.lang.Object
   ↳ java.util.AbstractMap<K, V>
     ↳ com.google.api.client.util.GenericData
       ↳ com.google.api.client.json.GenericJson
         ↳ com.kinvey.java.model.KinveyReference

Class Overview

A KinveyReference allows for entities to include relational data from other collections and entities.

To use this class within an Entities' GenericJson implementation, just define a field's type as a KinveyReference.

Then, when, making a GET call through the AppData API various parameters can be used to specify how the backend should handle these mappings.

The 'resolve' attribute can be passed a list of Strings containing all the KinveyReference fields that should be mapped. The appropriate field in the Response Object should also be a KinveyReference, but the relational mapping can be followed by accessing the returnObject field declared below.

'resolve_depth' is an int argument for GET requests through the AppData API, and will resolve all KinveyReferences up to N levels. Keep in mind a KinveyReference.returnObject can contain other embedded KinveyReferences, and so on, allowing for multiple mappings without explicitly declaring all fields.

`retain_references` is also supported, and can be used to pull the contents of returnObject up to replace the KinveyReference. This flag defaults to true, but can be explicitly set to false if an end user only cares about the 'returnObject' value.

Summary

Constants
String RESOLVED_KEY
String USER_COLLECTION This constant is deprecated. moved to USER_COLLECTION_NAME
Public Constructors
KinveyReference()
KinveyReference(String collectionName, String id)
Public Methods
String getCollection()
String getId()
GenericJson getResolvedObject()
GenericJson getReturnObject()
String getType()
void setCollection(String collection)
void setId(String id)
void setType(String type)
[Expand]
Inherited Methods
From class com.google.api.client.json.GenericJson
From class com.google.api.client.util.GenericData
From class java.util.AbstractMap
From class java.lang.Object
From interface java.util.Map

Constants

public static final String RESOLVED_KEY

Constant Value: "_obj"

public static final String USER_COLLECTION

This constant is deprecated.
moved to USER_COLLECTION_NAME

Constant Value: "user"

Public Constructors

public KinveyReference ()

public KinveyReference (String collectionName, String id)

Public Methods

public String getCollection ()

public String getId ()

public GenericJson getResolvedObject ()

public GenericJson getReturnObject ()

public String getType ()

public void setCollection (String collection)

public void setId (String id)

public void setType (String type)