Package io.realm.mongodb.sync
Interface Subscription
-
public interface SubscriptionA 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 aSubscriptionSetwith 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 Subscriptioncreate(RealmQuery query)Create an unmanaged anonymous subscription for a flexible sync enabled Realm.static Subscriptioncreate(String name, RealmQuery query)Create an unmanaged named subscription for a flexible sync enabled Realm.DategetCreatedAt()Returns the timestamp for when this subscription was persisted.StringgetName()Returns the name of subscription ornullif no name was defined.StringgetObjectType()Returns the type that is being queried.StringgetQuery()Returns the subscription query that is running on objects of typegetObjectType().DategetUpdatedAt()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 returnnulluntil the Subscription has been added using eitherMutableSubscriptionSet.add(Subscription)orMutableSubscriptionSet.addOrUpdate(Subscription).- Returns:
- the time this subscription was persisted, or
nullif the subscription hasn't been persisted yet.
-
getUpdatedAt
@Nullable Date getUpdatedAt()
Returns the timestamp for when a persisted subscription was updated. This will returnnulluntil the Subscription has been added using eitherMutableSubscriptionSet.add(Subscription)orMutableSubscriptionSet.addOrUpdate(Subscription).- Returns:
- the time this subscription was updated, or
nullif the subscription hasn't been persisted yet.
-
getName
@Nullable String getName()
Returns the name of subscription ornullif 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.
-
-