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 |
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.
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() | ||||||||||
String | getType() | ||||||||||
<T extends GenericJson> T | getTypedObject(Class<T> clazz) | ||||||||||
void | setCollection(String collection) | ||||||||||
void | setId(String id) | ||||||||||
void | setType(String type) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |