All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.influxdb.client.domain.WriteConsistency Maven / Gradle / Ivy

/*
 * InfluxDB OSS API Service
 * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 
 *
 * OpenAPI spec version: 2.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.influxdb.client.domain;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.annotations.SerializedName;

import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

/**
 * Gets or Sets WriteConsistency
 */
@JsonAdapter(WriteConsistency.Adapter.class)
public enum WriteConsistency {
  
  ANY("any"),
  
  ONE("one"),
  
  QUORUM("quorum"),
  
  ALL("all");

  private String value;

  WriteConsistency(String value) {
    this.value = value;
  }

  public String getValue() {
    return value;
  }

  @Override
  public String toString() {
    return String.valueOf(value);
  }

  public static WriteConsistency fromValue(String text) {
    for (WriteConsistency b : WriteConsistency.values()) {
      if (String.valueOf(b.value).equals(text)) {
        return b;
      }
    }
    return null;
  }

  public static class Adapter extends TypeAdapter {
    @Override
    public void write(final JsonWriter jsonWriter, final WriteConsistency enumeration) throws IOException {
      jsonWriter.value(enumeration.getValue());
    }

    @Override
    public WriteConsistency read(final JsonReader jsonReader) throws IOException {
      String value = jsonReader.nextString();
      return WriteConsistency.fromValue(String.valueOf(value));
    }
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy