Sync Android SDK  2.0.2
com.twilio.sync.SyncOptions Interface Reference

SyncOptions are used to pass variable information to SyncDocument, SyncMap, SyncList and SyncStream opening functions. More...

Public Member Functions

SyncOptions createWithUniqueName (String uniqueName)
 Creates a new object with specified unique name, fails if the given name is already in use. More...
 
SyncOptions withUniqueName (String uniqueName)
 Creates a new object or opens an existing one with provided unique name. More...
 
SyncOptions withUniqueName (String uniqueName, OpenMode mode)
 Creates a new object or opens an existing one with provided unique name, also given a specific opening mode. More...
 
SyncOptions openWithSidOrUniqueName (String sidOrUniqueName)
 Opens an existing object with specified SID or unique name. More...
 
SyncOptions withStrategy (SynchronizationStrategy strategy)
 Set SynchronizationStrategy the Sync object. More...
 
SyncOptions withTtl (int ttl)
 Set time to live for the Sync object in seconds. More...
 
String getSidOrUniqueName ()
 
OpenMode getOpenMode ()
 
SynchronizationStrategy getSynchronizationStrategy ()
 
int getTtl ()
 

Static Public Member Functions

static SyncOptions create ()
 Public factory method to create a new instance of SyncOptions. More...
 

Public Attributes

int INFINITE_DURATION = 0
 Time to live for a Sync object, specifying no expiry.
 

Detailed Description

SyncOptions are used to pass variable information to SyncDocument, SyncMap, SyncList and SyncStream opening functions.

Typical usage pattern:

new SyncOptions().withUniqueName("myName")

Member Function Documentation

static SyncOptions com.twilio.sync.SyncOptions.create ( )
static

Public factory method to create a new instance of SyncOptions.

Returns
new SyncOptions object.
SyncOptions com.twilio.sync.SyncOptions.createWithUniqueName ( String  uniqueName)

Creates a new object with specified unique name, fails if the given name is already in use.

This method is the same as withUniqueName(String, OpenMode) with OpenMode#CREATE_NEW mode.

Parameters
uniqueNameUnique name to assign to entity upon creation.
Returns
Self for chaining.
OpenMode com.twilio.sync.SyncOptions.getOpenMode ( )
Returns
Open mode, one of the constants OpenMode.
String com.twilio.sync.SyncOptions.getSidOrUniqueName ( )
Returns
SID or unique name.
SynchronizationStrategy com.twilio.sync.SyncOptions.getSynchronizationStrategy ( )
Returns
Synchronization strategy, one of the constants SynchronizationStrategy.
int com.twilio.sync.SyncOptions.getTtl ( )
Returns
Time to live in seconds from now or INFINITE_DURATION to indicate no expiry.
SyncOptions com.twilio.sync.SyncOptions.openWithSidOrUniqueName ( String  sidOrUniqueName)

Opens an existing object with specified SID or unique name.

Implementation will automatically detect whether a SID or a unique name has been provided, and behave accordingly. This method is the same as withUniqueName(String, OpenMode) with OpenMode#OPEN_EXISTING mode.

Parameters
sidOrUniqueNameSID or unique name to find existing entity or to assign to new entity upon creation.
Returns
Self for chaining.
SyncOptions com.twilio.sync.SyncOptions.withStrategy ( SynchronizationStrategy  strategy)

Set SynchronizationStrategy the Sync object.

Parameters
strategySynchronizationStrategy to assign to new entity.
Returns
Self for chaining.
SyncOptions com.twilio.sync.SyncOptions.withTtl ( int  ttl)

Set time to live for the Sync object in seconds.

This TTL specifies the minimum time the object will live, sometime soon after this time the object will be deleted.

If time to live is not specified, object lives infinitely long.

TTL could be used in order to auto-recycle old unused objects, but it is not recommended to build some app logic like timers using ttl.

This setting works with all object types, however note that it is applicable only when creating an object. When (re)opening an existing object, new TTL is not applied, and instead an old setting is retained, in order to avoid unexpected read-only object change.

Parameters
ttlTime to live in seconds from now or INFINITE_DURATION to indicate no expiry.
SyncOptions com.twilio.sync.SyncOptions.withUniqueName ( String  uniqueName)

Creates a new object or opens an existing one with provided unique name.

This method is the same as withUniqueName(String, OpenMode) with OpenMode#OPEN_OR_CREATE mode.

Parameters
uniqueNameUnique name to find existing entity or to assign to new entity upon creation.
Returns
Self for chaining.
SyncOptions com.twilio.sync.SyncOptions.withUniqueName ( String  uniqueName,
OpenMode  mode 
)

Creates a new object or opens an existing one with provided unique name, also given a specific opening mode.

Parameters
uniqueNameUnique name to find existing entity or to assign to new entity upon creation.
modeOpen mode, one of the constants OpenMode.
Returns
Self for chaining.