Class CollectionConfiguration

java.lang.Object
com.couchbase.lite.CollectionConfiguration

public class CollectionConfiguration extends Object
  • Constructor Details

    • CollectionConfiguration

      @Deprecated public CollectionConfiguration()
      Deprecated.
      This constructor is deprecated. Use CollectionConfiguration(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. Use CollectionConfiguration(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

      public CollectionConfiguration(@NonNull Collection collection)
      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 - The Collection instance to replicate.
  • Method Details

    • fromCollections

      @NonNull public static Set<CollectionConfiguration> fromCollections(@NonNull Collection<Collection> collections)
      Creates a set of CollectionConfiguration 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 of Collection instances to replicate.
      Returns:
      A set of CollectionConfiguration instances for the provided collections.
    • setDocumentIDs

      @NonNull public final CollectionConfiguration setDocumentIDs(@Nullable 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.
      Parameters:
      documentIDs - The document IDs.
      Returns:
      this.
    • setChannels

      @NonNull public final CollectionConfiguration setChannels(@Nullable List<String> channels)
      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

      @NonNull public final CollectionConfiguration setPullFilter(@Nullable ReplicationFilter pullFilter)
      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

      @NonNull public final CollectionConfiguration setPushFilter(@Nullable ReplicationFilter pushFilter)
      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

      @Nullable public final Collection getCollection()
      Returns the collection.
    • getChannels

      @Nullable public final List<String> 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

      @Nullable public final List<String> getDocumentIDs()
      A collection of document IDs to filter: if not nil, only documents with these IDs will be pushed and/or pulled.
    • getConflictResolver

      @Nullable public ConflictResolver getConflictResolver()
      Return the conflict resolver.
    • getPullFilter

      @Nullable public ReplicationFilter getPullFilter()
      Gets the filter used to determine whether a document will be pulled from the remote endpoint.
    • getPushFilter

      @Nullable public ReplicationFilter getPushFilter()
      Gets the filter used to determine whether a document will be pushed to the remote endpoint.
    • toString

      @NonNull public String toString()
      Overrides:
      toString in class Object