CreateOrUpdateIndexerOptions.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.

  3. package com.azure.search.documents.indexes.models;

  4. import java.util.Objects;

  5. /**
  6.  * This model represents a property bag containing all options for creating or updating an {@link SearchIndexer
  7.  * indexer}.
  8.  */
  9. public class CreateOrUpdateIndexerOptions {
  10.     private final SearchIndexer indexer;

  11.     private boolean onlyIfUnchanged;
  12.     private Boolean cacheReprocessingChangeDetectionDisabled;
  13.     private Boolean cacheResetRequirementsIgnored;

  14.     /**
  15.      * Creates the property bag used to create or update an {@link SearchIndexer indexer}.
  16.      *
  17.      * @param indexer The {@link SearchIndexer indexer} being created or updated.
  18.      * @throws NullPointerException If {@code indexer} is null.
  19.      */
  20.     public CreateOrUpdateIndexerOptions(SearchIndexer indexer) {
  21.         this.indexer = Objects.requireNonNull(indexer, "'indexer' cannot be null.");
  22.     }

  23.     /**
  24.      * Gets the {@link SearchIndexer indexer} that will be created or updated.
  25.      *
  26.      * @return The {@link SearchIndexer indexer} that will be created or updated.
  27.      */
  28.     public SearchIndexer getIndexer() {
  29.         return indexer;
  30.     }

  31.     /**
  32.      * Sets the flag that determines whether an update will only occur if the {@link SearchIndexer indexer} has not been
  33.      * changed since the update has been triggered.
  34.      *
  35.      * @param onlyIfUnchanged Flag that determines whether an update will only occur if the {@link SearchIndexer
  36.      * indexer} has not been changed since the update has been triggered.
  37.      * @return The updated CreateOrUpdateIndexerOptions object.
  38.      */
  39.     public CreateOrUpdateIndexerOptions setOnlyIfUnchanged(boolean onlyIfUnchanged) {
  40.         this.onlyIfUnchanged = onlyIfUnchanged;
  41.         return this;
  42.     }

  43.     /**
  44.      * Gets the flag that determines whether an update will only occur if the {@link SearchIndexer indexer} has not been
  45.      * changed since the update has been triggered.
  46.      *
  47.      * @return Whether an update will only occur if the {@link SearchIndexer indexer} has not been changed since the
  48.      * update has been triggered.
  49.      */
  50.     public boolean isOnlyIfUnchanged() {
  51.         return onlyIfUnchanged;
  52.     }

  53.     /**
  54.      * Sets an optional flag that determines whether the created or updated {@link SearchIndexer indexer} disables cache
  55.      * reprocessing change detection.
  56.      *
  57.      * @param cacheReprocessingChangeDetectionDisabled An optional flag that determines whether the created or updated
  58.      * {@link SearchIndexer indexer} disables cache reprocessing change detection.
  59.      * @return The updated CreateOrUpdateIndexerOptions object.
  60.      */
  61.     public CreateOrUpdateIndexerOptions setCacheReprocessingChangeDetectionDisabled(
  62.         Boolean cacheReprocessingChangeDetectionDisabled) {
  63.         this.cacheReprocessingChangeDetectionDisabled = cacheReprocessingChangeDetectionDisabled;
  64.         return this;
  65.     }

  66.     /**
  67.      * Gets an optional flag that determines whether the created or updated {@link SearchIndexer indexer} disables cache
  68.      * reprocessing change detection.
  69.      *
  70.      * @return Whether the created or updated {@link SearchIndexer indexer} disables cache reprocessing change
  71.      * detection.
  72.      */
  73.     public Boolean isCacheReprocessingChangeDetectionDisabled() {
  74.         return cacheReprocessingChangeDetectionDisabled;
  75.     }

  76.     /**
  77.      * Sets an optional flag that determines whether the created or updated {@link SearchIndexer indexer} ignores cache
  78.      * reset requirements.
  79.      *
  80.      * @param cacheResetRequirementsIgnored An optional flag that determines whether the created or updated {@link
  81.      * SearchIndexer indexer} ignores cache reset requirements.
  82.      * @return The updated CreateOrUpdateIndexerOptions object.
  83.      */
  84.     public CreateOrUpdateIndexerOptions setCacheResetRequirementsIgnored(Boolean cacheResetRequirementsIgnored) {
  85.         this.cacheResetRequirementsIgnored = cacheResetRequirementsIgnored;
  86.         return this;
  87.     }

  88.     /**
  89.      * Gets an optional flag that determines whether the created or updated {@link SearchIndexer indexer} ignores cache
  90.      * reset requirements.
  91.      *
  92.      * @return Whether the created or updated {@link SearchIndexer indexer} ignores cache reset requirements.
  93.      */
  94.     public Boolean isCacheResetRequirementsIgnored() {
  95.         return cacheResetRequirementsIgnored;
  96.     }
  97. }