Package com.couchbase.lite
Class CollectionConfiguration
java.lang.Object
com.couchbase.lite.CollectionConfiguration
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.This constructor is deprecated.CollectionConfiguration
(Collection collection) Creates a new configuration instance for the given collection.CollectionConfiguration
(List<String> channels, List<String> documentIDs, ReplicationFilter pullFilter, ReplicationFilter pushFilter, ConflictResolver conflictResolver) Deprecated.This constructor is deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<CollectionConfiguration>
fromCollections
(Collection<Collection> collections) Creates a set ofCollectionConfiguration
instances from the given collections.Sets a collection of Sync Gateway channel names from which to pull Documents.final Collection
Returns the collection.Return the conflict resolver.A collection of document IDs to filter: if not nil, only documents with these IDs will be pushed and/or pulled.Gets the filter used to determine whether a document will be pulled from the remote endpoint.Gets the filter used to determine whether a document will be pushed to the remote endpoint.final CollectionConfiguration
setChannels
(List<String> channels) Sets a collection of Sync Gateway channel names from which to pull Documents.final CollectionConfiguration
setConflictResolver
(ConflictResolver conflictResolver) Sets the conflict resolver.final CollectionConfiguration
setDocumentIDs
(List<String> documentIDs) Sets a collection of document IDs to filter by: if given, only documents with these IDs will be pushed and/or pulled.final CollectionConfiguration
setPullFilter
(ReplicationFilter pullFilter) Sets a filter object for validating whether the documents can be pulled from the remote endpoint.final CollectionConfiguration
setPushFilter
(ReplicationFilter pushFilter) Sets a filter object for validating whether the documents can be pushed to the remote endpoint.toString()
-
Constructor Details
-
CollectionConfiguration
Deprecated.This constructor is deprecated. UseCollectionConfiguration(Collection)
and setter methods to configure channels, filters, and a custom conflict resolver.Creates a configuration instance. -
CollectionConfiguration
@Deprecated public CollectionConfiguration(@Nullable List<String> channels, @Nullable List<String> documentIDs, @Nullable ReplicationFilter pullFilter, @Nullable ReplicationFilter pushFilter, @Nullable ConflictResolver conflictResolver) Deprecated.This constructor is deprecated. UseCollectionConfiguration(Collection)
and setter methods to configure channels, filters, and a custom conflict resolver.Creates a configuration instance.- Parameters:
channels
- The list of channels to pull from Sync Gateway.documentIDs
- The list of document IDs to filter replication.pullFilter
- The filter function for pulling documents.pushFilter
- The filter function for pushing documents.conflictResolver
- The custom conflict resolver.
-
CollectionConfiguration
Creates a new configuration instance for the given collection.Use setter methods to customize the configuration such as channels, filters or a custom conflict resolver.
- Parameters:
collection
- TheCollection
instance to replicate.
-
-
Method Details
-
fromCollections
@NonNull public static Set<CollectionConfiguration> fromCollections(@NonNull Collection<Collection> collections) Creates a set ofCollectionConfiguration
instances from the given collections.Each specified collection will be wrapped in a
CollectionConfiguration
using default settings (no filters and no custom conflict resolvers).This is a convenience method for configuring multiple collections with default replication settings. If custom configurations are needed, construct
CollectionConfiguration
instances directly instead.- Parameters:
collections
- A collection ofCollection
instances to replicate.- Returns:
- A set of
CollectionConfiguration
instances for the provided collections.
-
setDocumentIDs
Sets a collection of document IDs to filter by: if given, only documents with these IDs will be pushed and/or pulled.- Parameters:
documentIDs
- The document IDs.- Returns:
- this.
-
setChannels
Sets a collection of Sync Gateway channel names from which to pull Documents. If unset, all accessible channels will be pulled. Default is empty: pull from all accessible channels. Note: Channel specifications apply only to replications pulling from a SyncGateway and only the channels visible to the authenticated user. Channel specs are ignored:- during a push replication.
- during peer-to-peer or database-to-database replication
- when the specified channel is not accessible to the user
- Parameters:
channels
- The Sync Gateway channel names.- Returns:
- this.
-
setConflictResolver
@NonNull public final CollectionConfiguration setConflictResolver(@Nullable ConflictResolver conflictResolver) Sets the conflict resolver.- Parameters:
conflictResolver
- A conflict resolver.- Returns:
- this.
-
setPullFilter
Sets a filter object for validating whether the documents can be pulled from the remote endpoint. Only documents for which the object returns true are replicated.- Parameters:
pullFilter
- The filter to filter the document to be pulled.- Returns:
- this.
-
setPushFilter
Sets a filter object for validating whether the documents can be pushed to the remote endpoint.- Parameters:
pushFilter
- The filter to filter the document to be pushed.- Returns:
- this.
-
getCollection
Returns the collection. -
getChannels
Sets a collection of Sync Gateway channel names from which to pull Documents. If unset, all accessible channels will be pulled. Default is empty: pull from all accessible channels. Note: Channel specifications apply only to replications pulling from a SyncGateway and only the channels visible to the authenticated user. Channel specs are ignored:- during a push replication.
- during peer-to-peer or database-to-database replication
- when the specified channel is not accessible to the user
-
getDocumentIDs
A collection of document IDs to filter: if not nil, only documents with these IDs will be pushed and/or pulled. -
getConflictResolver
Return the conflict resolver. -
getPullFilter
Gets the filter used to determine whether a document will be pulled from the remote endpoint. -
getPushFilter
Gets the filter used to determine whether a document will be pushed to the remote endpoint. -
toString
-