Class WriteParameters

java.lang.Object
com.influxdb.client.write.WriteParameters

@ThreadSafe public final class WriteParameters extends Object
Write API parameters.

Supports to specify:

  • bucket - Specifies the destination bucket for writes.
  • org - Specifies the destination organization for writes.
  • precision - Precision for unix timestamps in the line protocol of the request payload.
  • consistency - The write consistency for the point. InfluxDB assumes that the write consistency is WriteConsistency.ONE if you do not specify consistency. See the InfluxDB Enterprise documentation for detailed descriptions of each consistency option. Available with InfluxDB Enterprise clusters only!
  • Field Details

    • DEFAULT_WRITE_PRECISION

      public static final WritePrecision DEFAULT_WRITE_PRECISION
  • Constructor Details

    • WriteParameters

      public WriteParameters(@Nullable String bucket, @Nullable String org, @Nullable WritePrecision precision, @Nullable WriteConsistency consistency)
      Construct WriteAPI parameters.
      Parameters:
      bucket - The destination bucket for writes. If it is not specified then use InfluxDBClientOptions.getBucket().
      org - The destination organization for writes. If it is not specified then use InfluxDBClientOptions.getOrg().
      precision - Precision for unix timestamps in the line protocol of the request payload. If it is not specified then use WritePrecision.NS.
      consistency - The write consistency for the point. For more info see WriteParameters.
    • WriteParameters

      public WriteParameters(@Nullable WritePrecision precision, @Nullable WriteConsistency consistency)
      Construct WriteAPI parameters.
      Parameters:
      precision - Precision for unix timestamps in the line protocol of the request payload. If it is not specified then use WritePrecision.NS.
      consistency - The write consistency for the point. For more info see WriteParameters.
    • WriteParameters

      public WriteParameters(@Nonnull String bucket, @Nonnull String org, @Nonnull WritePrecision precision)
      The backward internal constructor, please use WriteParameters(String, String, WritePrecision, WriteConsistency).
      Parameters:
      bucket - The destination bucket for writes.
      org - The destination organization for writes.
      precision - Precision for unix timestamps in the line protocol of the request payload.
  • Method Details

    • orgSafe

      @Nonnull public String orgSafe(@Nonnull InfluxDBClientOptions options)
      Parameters:
      options - with default value
      Returns:
      The destination organization for writes.
    • bucketSafe

      @Nonnull public String bucketSafe(@Nonnull InfluxDBClientOptions options)
      Parameters:
      options - with default value
      Returns:
      The destination bucket for writes.
    • precisionSafe

      @Nonnull public WritePrecision precisionSafe(@Nonnull InfluxDBClientOptions options)
      Parameters:
      options - with default value
      Returns:
      Precision for unix timestamps in the line protocol of the request payload.
    • consistencySafe

      @Nullable public WriteConsistency consistencySafe(@Nonnull InfluxDBClientOptions options)
      Parameters:
      options - with default value
      Returns:
      The write consistency for the point.
    • check

      public void check(@Nonnull InfluxDBClientOptions options)
      Enforces that the destination bucket and destination organization are defined.
      Parameters:
      options - with default values
      Throws:
      IllegalArgumentException - if the bucket or organization is not defined
    • copy

      @Nonnull public WriteParameters copy(@Nonnull WritePrecision precision, @Nonnull InfluxDBClientOptions options)
      Copy current parameters with new precision.
      Parameters:
      precision - new precision
      options - default values
      Returns:
      copied parameters
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object