FieldMapping.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. //
  4. // Code generated by Microsoft (R) AutoRest Code Generator.
  5. // Changes may cause incorrect behavior and will be lost if the code is
  6. // regenerated.

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

  8. import com.azure.core.annotation.Fluent;
  9. import com.fasterxml.jackson.annotation.JsonCreator;
  10. import com.fasterxml.jackson.annotation.JsonProperty;

  11. /** Defines a mapping between a field in a data source and a target field in an index. */
  12. @Fluent
  13. public final class FieldMapping {
  14.     /*
  15.      * The name of the field in the data source.
  16.      */
  17.     @JsonProperty(value = "sourceFieldName", required = true)
  18.     private String sourceFieldName;

  19.     /*
  20.      * The name of the target field in the index. Same as the source field name
  21.      * by default.
  22.      */
  23.     @JsonProperty(value = "targetFieldName")
  24.     private String targetFieldName;

  25.     /*
  26.      * A function to apply to each source field value before indexing.
  27.      */
  28.     @JsonProperty(value = "mappingFunction")
  29.     private FieldMappingFunction mappingFunction;

  30.     /**
  31.      * Creates an instance of FieldMapping class.
  32.      *
  33.      * @param sourceFieldName the sourceFieldName value to set.
  34.      */
  35.     @JsonCreator
  36.     public FieldMapping(@JsonProperty(value = "sourceFieldName", required = true) String sourceFieldName) {
  37.         this.sourceFieldName = sourceFieldName;
  38.     }

  39.     /**
  40.      * Get the sourceFieldName property: The name of the field in the data source.
  41.      *
  42.      * @return the sourceFieldName value.
  43.      */
  44.     public String getSourceFieldName() {
  45.         return this.sourceFieldName;
  46.     }

  47.     /**
  48.      * Get the targetFieldName property: The name of the target field in the index. Same as the source field name by
  49.      * default.
  50.      *
  51.      * @return the targetFieldName value.
  52.      */
  53.     public String getTargetFieldName() {
  54.         return this.targetFieldName;
  55.     }

  56.     /**
  57.      * Set the targetFieldName property: The name of the target field in the index. Same as the source field name by
  58.      * default.
  59.      *
  60.      * @param targetFieldName the targetFieldName value to set.
  61.      * @return the FieldMapping object itself.
  62.      */
  63.     public FieldMapping setTargetFieldName(String targetFieldName) {
  64.         this.targetFieldName = targetFieldName;
  65.         return this;
  66.     }

  67.     /**
  68.      * Get the mappingFunction property: A function to apply to each source field value before indexing.
  69.      *
  70.      * @return the mappingFunction value.
  71.      */
  72.     public FieldMappingFunction getMappingFunction() {
  73.         return this.mappingFunction;
  74.     }

  75.     /**
  76.      * Set the mappingFunction property: A function to apply to each source field value before indexing.
  77.      *
  78.      * @param mappingFunction the mappingFunction value to set.
  79.      * @return the FieldMapping object itself.
  80.      */
  81.     public FieldMapping setMappingFunction(FieldMappingFunction mappingFunction) {
  82.         this.mappingFunction = mappingFunction;
  83.         return this;
  84.     }
  85. }