Package io.realm.mongodb.sync
Interface MutableSubscriptionSet
-
- All Superinterfaces:
Iterable<Subscription>
,SubscriptionSet
public interface MutableSubscriptionSet extends SubscriptionSet
A mutable subscription set is available when callingSubscriptionSet.update(UpdateCallback)
This is the only way to modify aSubscriptionSet
.Subscription
s can be either managed or unmanaged. Unmanaged subscriptions are those created by usingSubscription.create(RealmQuery)
orSubscription.create(String, RealmQuery)
, while managed subscriptions are the ones being returned from the subscription set.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.realm.mongodb.sync.SubscriptionSet
SubscriptionSet.State, SubscriptionSet.StateChangeCallback, SubscriptionSet.UpdateAsyncCallback, SubscriptionSet.UpdateCallback
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Subscription
add(Subscription subscription)
Adds a new unmanaged subscription to the subscription set.Subscription
addOrUpdate(Subscription subscription)
Add a new subscription or update an existing named subscription.boolean
remove(Subscription subscription)
Remove a managed subscription.boolean
remove(String name)
Remove a named subscription.boolean
removeAll()
Remove all current managed subscriptions.<T extends RealmModel>
booleanremoveAll(Class<T> clazz)
Remove all subscriptions with queries on a given given model class.boolean
removeAll(String objectType)
Remove all subscriptions on a givenSubscription.getObjectType()
.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface io.realm.mongodb.sync.SubscriptionSet
find, find, getErrorMessage, getState, size, update, updateAsync, waitForSynchronization, waitForSynchronization, waitForSynchronizationAsync, waitForSynchronizationAsync
-
-
-
-
Method Detail
-
add
Subscription add(Subscription subscription)
Adds a new unmanaged subscription to the subscription set.- Parameters:
subscription
- unmanaged subscription to add.- Returns:
- the newly added managed subscription.
- Throws:
IllegalArgumentException
- if a subscription matching the provided one already exists.
-
addOrUpdate
Subscription addOrUpdate(Subscription subscription)
Add a new subscription or update an existing named subscription. It isn't possible to update an anonymous subscription. These must removed and re-inserted.- Parameters:
subscription
- anonymous or named subscription created viaSubscription.create(...)
, used to update a matching one within a specific set. It creates a new one in case there is no match..- Returns:
- the updated or inserted managed subscription.
-
remove
boolean remove(Subscription subscription)
Remove a managed subscription.- Parameters:
subscription
- managed subscription to remove- Returns:
true
if the subscription was removed,false
if not.- Throws:
IllegalArgumentException
- if the subscription provided is unmanaged. Only managed subscriptions can be used as input.
-
remove
boolean remove(String name)
Remove a named subscription.- Parameters:
name
- name of managed subscription to remove.- Returns:
true
if the subscription was removed,false
if not.
-
removeAll
boolean removeAll(String objectType)
Remove all subscriptions on a givenSubscription.getObjectType()
.- Parameters:
objectType
- subscriptions on this object type will be removed.- Returns:
true
if 1 or more subscriptions were removed,false
if no subscriptions were removed.
-
removeAll
<T extends RealmModel> boolean removeAll(Class<T> clazz)
Remove all subscriptions with queries on a given given model class.- Parameters:
clazz
- subscriptions on this type will be removed.- Returns:
true
if 1 or more subscriptions were removed,false
if no subscriptions were removed.
-
removeAll
boolean removeAll()
Remove all current managed subscriptions.- Returns:
true
if 1 or more subscriptions were removed,false
if no subscriptions were removed.
-
-