Package io.realm.mongodb.sync
Interface Subscription
-
public interface Subscription
A subscription defines a specific server query and its metadata. The result of this query is continuously being synchronized with the device as long as the subscription is part of aSubscriptionSet
with a state ofSubscriptionSet.State.COMPLETE
. Subscriptions are immutable once created, but they can be updated by using aMutableSubscriptionSet.addOrUpdate(Subscription)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Subscription
create(RealmQuery query)
Create an unmanaged anonymous subscription for a flexible sync enabled Realm.static Subscription
create(String name, RealmQuery query)
Create an unmanaged named subscription for a flexible sync enabled Realm.Date
getCreatedAt()
Returns the timestamp for when this subscription was persisted.String
getName()
Returns the name of subscription ornull
if no name was defined.String
getObjectType()
Returns the type that is being queried.String
getQuery()
Returns the subscription query that is running on objects of typegetObjectType()
.Date
getUpdatedAt()
Returns the timestamp for when a persisted subscription was updated.
-
-
-
Method Detail
-
create
static Subscription create(String name, RealmQuery query)
Create an unmanaged named subscription for a flexible sync enabled Realm. The subscription will not take effect until it has been stored using eitherMutableSubscriptionSet.add(Subscription)
orMutableSubscriptionSet.addOrUpdate(Subscription)
.- Parameters:
name
- the name of the subscriptionquery
- the query that is subscribed to. Note, subscription queries have restrictions compared to normal queries.- Returns:
- the unmanaged subscription.
-
create
static Subscription create(RealmQuery query)
Create an unmanaged anonymous subscription for a flexible sync enabled Realm. The subscription will not take effect until it has been stored using eitherMutableSubscriptionSet.add(Subscription)
orMutableSubscriptionSet.addOrUpdate(Subscription)
.- Parameters:
query
- the query that is subscribed to. Note, subscription queries have restrictions compared to normal queries.- Returns:
- the unmanaged subscription.
-
getCreatedAt
@Nullable Date getCreatedAt()
Returns the timestamp for when this subscription was persisted. This will returnnull
until the Subscription has been added using eitherMutableSubscriptionSet.add(Subscription)
orMutableSubscriptionSet.addOrUpdate(Subscription)
.- Returns:
- the time this subscription was persisted, or
null
if the subscription hasn't been persisted yet.
-
getUpdatedAt
@Nullable Date getUpdatedAt()
Returns the timestamp for when a persisted subscription was updated. This will returnnull
until the Subscription has been added using eitherMutableSubscriptionSet.add(Subscription)
orMutableSubscriptionSet.addOrUpdate(Subscription)
.- Returns:
- the time this subscription was updated, or
null
if the subscription hasn't been persisted yet.
-
getName
@Nullable String getName()
Returns the name of subscription ornull
if no name was defined.- Returns:
- the name of the subscription.
-
getObjectType
String getObjectType()
Returns the type that is being queried.- Returns:
- the type that is being queried.
-
getQuery
String getQuery()
Returns the subscription query that is running on objects of typegetObjectType()
.- Returns:
- the query covered by this subscription.
-
-