/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.monitoring.v3.model;

/**
 * A locator for text. Indicates a particular part of the text of a request or of an object
 * referenced in the request.For example, suppose the request field text contains:text: "The quick
 * brown fox jumps over the lazy dog."Then the locator:source: "text" start_position { line: 1
 * column: 17 } end_position { line: 1 column: 19 }refers to the part of the text: "fox".
 *
 * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Monitoring API. For a detailed explanation see:
 * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
 * </p>
 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class TextLocator extends com.google.api.client.json.GenericJson {

  /**
   * The position of the last byte within the text.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Position endPosition;

  /**
   * If source, start_position, and end_position describe a call on some object (e.g. a macro in the
   * time series query language text) and a location is to be designated in that object's text,
   * nested_locator identifies the location within that object.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private TextLocator nestedLocator;

  /**
   * When nested_locator is set, this field gives the reason for the nesting. Usually, the reason is
   * a macro invocation. In that case, the macro name (including the leading '@') signals the
   * location of the macro call in the text and a macro argument name (including the leading '$')
   * signals the location of the macro argument inside the macro body that got substituted away.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String nestingReason;

  /**
   * The source of the text. The source may be a field in the request, in which case its format is
   * the format of the google.rpc.BadRequest.FieldViolation.field field in
   * https://cloud.google.com/apis/design/errors#error_details. It may also be be a source other
   * than the request field (e.g. a macro definition referenced in the text of the query), in which
   * case this is the name of the source (e.g. the macro name).
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String source;

  /**
   * The position of the first byte within the text.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Position startPosition;

  /**
   * The position of the last byte within the text.
   * @return value or {@code null} for none
   */
  public Position getEndPosition() {
    return endPosition;
  }

  /**
   * The position of the last byte within the text.
   * @param endPosition endPosition or {@code null} for none
   */
  public TextLocator setEndPosition(Position endPosition) {
    this.endPosition = endPosition;
    return this;
  }

  /**
   * If source, start_position, and end_position describe a call on some object (e.g. a macro in the
   * time series query language text) and a location is to be designated in that object's text,
   * nested_locator identifies the location within that object.
   * @return value or {@code null} for none
   */
  public TextLocator getNestedLocator() {
    return nestedLocator;
  }

  /**
   * If source, start_position, and end_position describe a call on some object (e.g. a macro in the
   * time series query language text) and a location is to be designated in that object's text,
   * nested_locator identifies the location within that object.
   * @param nestedLocator nestedLocator or {@code null} for none
   */
  public TextLocator setNestedLocator(TextLocator nestedLocator) {
    this.nestedLocator = nestedLocator;
    return this;
  }

  /**
   * When nested_locator is set, this field gives the reason for the nesting. Usually, the reason is
   * a macro invocation. In that case, the macro name (including the leading '@') signals the
   * location of the macro call in the text and a macro argument name (including the leading '$')
   * signals the location of the macro argument inside the macro body that got substituted away.
   * @return value or {@code null} for none
   */
  public java.lang.String getNestingReason() {
    return nestingReason;
  }

  /**
   * When nested_locator is set, this field gives the reason for the nesting. Usually, the reason is
   * a macro invocation. In that case, the macro name (including the leading '@') signals the
   * location of the macro call in the text and a macro argument name (including the leading '$')
   * signals the location of the macro argument inside the macro body that got substituted away.
   * @param nestingReason nestingReason or {@code null} for none
   */
  public TextLocator setNestingReason(java.lang.String nestingReason) {
    this.nestingReason = nestingReason;
    return this;
  }

  /**
   * The source of the text. The source may be a field in the request, in which case its format is
   * the format of the google.rpc.BadRequest.FieldViolation.field field in
   * https://cloud.google.com/apis/design/errors#error_details. It may also be be a source other
   * than the request field (e.g. a macro definition referenced in the text of the query), in which
   * case this is the name of the source (e.g. the macro name).
   * @return value or {@code null} for none
   */
  public java.lang.String getSource() {
    return source;
  }

  /**
   * The source of the text. The source may be a field in the request, in which case its format is
   * the format of the google.rpc.BadRequest.FieldViolation.field field in
   * https://cloud.google.com/apis/design/errors#error_details. It may also be be a source other
   * than the request field (e.g. a macro definition referenced in the text of the query), in which
   * case this is the name of the source (e.g. the macro name).
   * @param source source or {@code null} for none
   */
  public TextLocator setSource(java.lang.String source) {
    this.source = source;
    return this;
  }

  /**
   * The position of the first byte within the text.
   * @return value or {@code null} for none
   */
  public Position getStartPosition() {
    return startPosition;
  }

  /**
   * The position of the first byte within the text.
   * @param startPosition startPosition or {@code null} for none
   */
  public TextLocator setStartPosition(Position startPosition) {
    this.startPosition = startPosition;
    return this;
  }

  @Override
  public TextLocator set(String fieldName, Object value) {
    return (TextLocator) super.set(fieldName, value);
  }

  @Override
  public TextLocator clone() {
    return (TextLocator) super.clone();
  }

}
