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

gobblin.metrics.MetricReport Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package gobblin.metrics;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class MetricReport extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"MetricReport\",\"namespace\":\"gobblin.metrics\",\"fields\":[{\"name\":\"tags\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"Tags associated with the metrics.\"},{\"name\":\"timestamp\",\"type\":\"long\",\"doc\":\"Time at which metrics were reported.\"},{\"name\":\"metrics\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"Metric\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Metric name.\"},{\"name\":\"value\",\"type\":\"double\",\"doc\":\"Metric value.\"}]}},\"doc\":\"Array of metrics in this report.\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** Tags associated with the metrics. */
  @Deprecated public java.util.Map tags;
  /** Time at which metrics were reported. */
  @Deprecated public long timestamp;
  /** Array of metrics in this report. */
  @Deprecated public java.util.List metrics;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder(). 
   */
  public MetricReport() {}

  /**
   * All-args constructor.
   */
  public MetricReport(java.util.Map tags, java.lang.Long timestamp, java.util.List metrics) {
    this.tags = tags;
    this.timestamp = timestamp;
    this.metrics = metrics;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call. 
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return tags;
    case 1: return timestamp;
    case 2: return metrics;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call. 
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: tags = (java.util.Map)value$; break;
    case 1: timestamp = (java.lang.Long)value$; break;
    case 2: metrics = (java.util.List)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'tags' field.
   * Tags associated with the metrics.   */
  public java.util.Map getTags() {
    return tags;
  }

  /**
   * Sets the value of the 'tags' field.
   * Tags associated with the metrics.   * @param value the value to set.
   */
  public void setTags(java.util.Map value) {
    this.tags = value;
  }

  /**
   * Gets the value of the 'timestamp' field.
   * Time at which metrics were reported.   */
  public java.lang.Long getTimestamp() {
    return timestamp;
  }

  /**
   * Sets the value of the 'timestamp' field.
   * Time at which metrics were reported.   * @param value the value to set.
   */
  public void setTimestamp(java.lang.Long value) {
    this.timestamp = value;
  }

  /**
   * Gets the value of the 'metrics' field.
   * Array of metrics in this report.   */
  public java.util.List getMetrics() {
    return metrics;
  }

  /**
   * Sets the value of the 'metrics' field.
   * Array of metrics in this report.   * @param value the value to set.
   */
  public void setMetrics(java.util.List value) {
    this.metrics = value;
  }

  /** Creates a new MetricReport RecordBuilder */
  public static gobblin.metrics.MetricReport.Builder newBuilder() {
    return new gobblin.metrics.MetricReport.Builder();
  }
  
  /** Creates a new MetricReport RecordBuilder by copying an existing Builder */
  public static gobblin.metrics.MetricReport.Builder newBuilder(gobblin.metrics.MetricReport.Builder other) {
    return new gobblin.metrics.MetricReport.Builder(other);
  }
  
  /** Creates a new MetricReport RecordBuilder by copying an existing MetricReport instance */
  public static gobblin.metrics.MetricReport.Builder newBuilder(gobblin.metrics.MetricReport other) {
    return new gobblin.metrics.MetricReport.Builder(other);
  }
  
  /**
   * RecordBuilder for MetricReport instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
    implements org.apache.avro.data.RecordBuilder {

    private java.util.Map tags;
    private long timestamp;
    private java.util.List metrics;

    /** Creates a new Builder */
    private Builder() {
      super(gobblin.metrics.MetricReport.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(gobblin.metrics.MetricReport.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.tags)) {
        this.tags = data().deepCopy(fields()[0].schema(), other.tags);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.timestamp)) {
        this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.metrics)) {
        this.metrics = data().deepCopy(fields()[2].schema(), other.metrics);
        fieldSetFlags()[2] = true;
      }
    }
    
    /** Creates a Builder by copying an existing MetricReport instance */
    private Builder(gobblin.metrics.MetricReport other) {
            super(gobblin.metrics.MetricReport.SCHEMA$);
      if (isValidValue(fields()[0], other.tags)) {
        this.tags = data().deepCopy(fields()[0].schema(), other.tags);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.timestamp)) {
        this.timestamp = data().deepCopy(fields()[1].schema(), other.timestamp);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.metrics)) {
        this.metrics = data().deepCopy(fields()[2].schema(), other.metrics);
        fieldSetFlags()[2] = true;
      }
    }

    /** Gets the value of the 'tags' field */
    public java.util.Map getTags() {
      return tags;
    }
    
    /** Sets the value of the 'tags' field */
    public gobblin.metrics.MetricReport.Builder setTags(java.util.Map value) {
      validate(fields()[0], value);
      this.tags = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'tags' field has been set */
    public boolean hasTags() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'tags' field */
    public gobblin.metrics.MetricReport.Builder clearTags() {
      tags = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'timestamp' field */
    public java.lang.Long getTimestamp() {
      return timestamp;
    }
    
    /** Sets the value of the 'timestamp' field */
    public gobblin.metrics.MetricReport.Builder setTimestamp(long value) {
      validate(fields()[1], value);
      this.timestamp = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'timestamp' field has been set */
    public boolean hasTimestamp() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'timestamp' field */
    public gobblin.metrics.MetricReport.Builder clearTimestamp() {
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'metrics' field */
    public java.util.List getMetrics() {
      return metrics;
    }
    
    /** Sets the value of the 'metrics' field */
    public gobblin.metrics.MetricReport.Builder setMetrics(java.util.List value) {
      validate(fields()[2], value);
      this.metrics = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'metrics' field has been set */
    public boolean hasMetrics() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'metrics' field */
    public gobblin.metrics.MetricReport.Builder clearMetrics() {
      metrics = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public MetricReport build() {
      try {
        MetricReport record = new MetricReport();
        record.tags = fieldSetFlags()[0] ? this.tags : (java.util.Map) defaultValue(fields()[0]);
        record.timestamp = fieldSetFlags()[1] ? this.timestamp : (java.lang.Long) defaultValue(fields()[1]);
        record.metrics = fieldSetFlags()[2] ? this.metrics : (java.util.List) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy