public class

AbstractKinveyOfflineClientRequest

extends AbstractKinveyJsonClientRequest<T>
java.lang.Object
   ↳ java.util.AbstractMap<K, V>
     ↳ com.google.api.client.util.GenericData
       ↳ com.kinvey.java.core.AbstractKinveyClientRequest<T>
         ↳ com.kinvey.java.core.AbstractKinveyJsonClientRequest<T>
           ↳ com.kinvey.java.offline.AbstractKinveyOfflineClientRequest<T>
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Implementation of a Client Request, which can either pull a response from a Cache instance or from online.

Behavior is determined by a CachePolicy, which must be set along with an instance of a Cache.

This class provides all available functionality through public methods, but most of the implementation is handled by the specified cache policy.

Summary

Public Methods
T execute()
@return
static String generateMongoDBID()
Generate a unique mongodb style id.
KinveyClientCallback<T> getCallback()
static String getUUID()
T offlineFromService(boolean assumeOnline)
This method retrieves an entity from the service.
T offlineFromStore()
This method retrieves an entity from the offline store.
void setCallback(KinveyClientCallback<T> callback)
[Expand]
Inherited Methods
From class com.kinvey.java.core.AbstractKinveyJsonClientRequest
From class com.kinvey.java.core.AbstractKinveyClientRequest
From class com.google.api.client.util.GenericData
From class java.util.AbstractMap
From class java.lang.Object
From interface java.util.Map

Public Methods

public T execute ()

@return

Throws
IOException

public static String generateMongoDBID ()

Generate a unique mongodb style id.

Offline requires all entities to have an `_id` field, so if one doesn't exist this method can be used to generate one

Returns
  • a unique String id

public KinveyClientCallback<T> getCallback ()

public static String getUUID ()

public T offlineFromService (boolean assumeOnline)

This method retrieves an entity from the service. If assumeOnline is true, then the method will throw any connection errors. If assumeOnline is false, then the method will catch the error and attempt to return the entity from the store.

Parameters
assumeOnline - should execution assume the user is online (and return errors if they aren't)?
Returns
  • an entity from the online collection
Throws
IOException

public T offlineFromStore ()

This method retrieves an entity from the offline store.

This method is synchronized on an object lock, providing threadsafe access to the store.

Returns
  • an entity or null, from the store
Throws
IOException

public void setCallback (KinveyClientCallback<T> callback)