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

org.opencb.biodata.models.variant.avro.Constraint Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.opencb.biodata.models.variant.avro;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Constraint 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\":\"Constraint\",\"namespace\":\"org.opencb.biodata.models.variant.avro\",\"fields\":[{\"name\":\"source\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]},{\"name\":\"method\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]},{\"name\":\"name\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]},{\"name\":\"value\",\"type\":[\"null\",\"double\"]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   private java.lang.String source;
   private java.lang.String method;
   private java.lang.String name;
   private java.lang.Double value;

  /**
   * 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 Constraint() {}

  /**
   * All-args constructor.
   */
  public Constraint(java.lang.String source, java.lang.String method, java.lang.String name, java.lang.Double value) {
    this.source = source;
    this.method = method;
    this.name = name;
    this.value = value;
  }

  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 source;
    case 1: return method;
    case 2: return name;
    case 3: return value;
    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: source = (java.lang.String)value$; break;
    case 1: method = (java.lang.String)value$; break;
    case 2: name = (java.lang.String)value$; break;
    case 3: value = (java.lang.Double)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'source' field.
   */
  public java.lang.String getSource() {
    return source;
  }

  /**
   * Sets the value of the 'source' field.
   * @param value the value to set.
   */
  public void setSource(java.lang.String value) {
    this.source = value;
  }

  /**
   * Gets the value of the 'method' field.
   */
  public java.lang.String getMethod() {
    return method;
  }

  /**
   * Sets the value of the 'method' field.
   * @param value the value to set.
   */
  public void setMethod(java.lang.String value) {
    this.method = value;
  }

  /**
   * Gets the value of the 'name' field.
   */
  public java.lang.String getName() {
    return name;
  }

  /**
   * Sets the value of the 'name' field.
   * @param value the value to set.
   */
  public void setName(java.lang.String value) {
    this.name = value;
  }

  /**
   * Gets the value of the 'value' field.
   */
  public java.lang.Double getValue() {
    return value;
  }

  /**
   * Sets the value of the 'value' field.
   * @param value the value to set.
   */
  public void setValue(java.lang.Double value) {
    this.value = value;
  }

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

    private java.lang.String source;
    private java.lang.String method;
    private java.lang.String name;
    private java.lang.Double value;

    /** Creates a new Builder */
    private Builder() {
      super(org.opencb.biodata.models.variant.avro.Constraint.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.opencb.biodata.models.variant.avro.Constraint.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.source)) {
        this.source = data().deepCopy(fields()[0].schema(), other.source);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.method)) {
        this.method = data().deepCopy(fields()[1].schema(), other.method);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.name)) {
        this.name = data().deepCopy(fields()[2].schema(), other.name);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.value)) {
        this.value = data().deepCopy(fields()[3].schema(), other.value);
        fieldSetFlags()[3] = true;
      }
    }
    
    /** Creates a Builder by copying an existing Constraint instance */
    private Builder(org.opencb.biodata.models.variant.avro.Constraint other) {
            super(org.opencb.biodata.models.variant.avro.Constraint.SCHEMA$);
      if (isValidValue(fields()[0], other.source)) {
        this.source = data().deepCopy(fields()[0].schema(), other.source);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.method)) {
        this.method = data().deepCopy(fields()[1].schema(), other.method);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.name)) {
        this.name = data().deepCopy(fields()[2].schema(), other.name);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.value)) {
        this.value = data().deepCopy(fields()[3].schema(), other.value);
        fieldSetFlags()[3] = true;
      }
    }

    /** Gets the value of the 'source' field */
    public java.lang.String getSource() {
      return source;
    }
    
    /** Sets the value of the 'source' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder setSource(java.lang.String value) {
      validate(fields()[0], value);
      this.source = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'source' field has been set */
    public boolean hasSource() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'source' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder clearSource() {
      source = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'method' field */
    public java.lang.String getMethod() {
      return method;
    }
    
    /** Sets the value of the 'method' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder setMethod(java.lang.String value) {
      validate(fields()[1], value);
      this.method = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'method' field has been set */
    public boolean hasMethod() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'method' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder clearMethod() {
      method = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'name' field */
    public java.lang.String getName() {
      return name;
    }
    
    /** Sets the value of the 'name' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder setName(java.lang.String value) {
      validate(fields()[2], value);
      this.name = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'name' field has been set */
    public boolean hasName() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'name' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder clearName() {
      name = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /** Gets the value of the 'value' field */
    public java.lang.Double getValue() {
      return value;
    }
    
    /** Sets the value of the 'value' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder setValue(java.lang.Double value) {
      validate(fields()[3], value);
      this.value = value;
      fieldSetFlags()[3] = true;
      return this; 
    }
    
    /** Checks whether the 'value' field has been set */
    public boolean hasValue() {
      return fieldSetFlags()[3];
    }
    
    /** Clears the value of the 'value' field */
    public org.opencb.biodata.models.variant.avro.Constraint.Builder clearValue() {
      value = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    @Override
    public Constraint build() {
      try {
        Constraint record = new Constraint();
        record.source = fieldSetFlags()[0] ? this.source : (java.lang.String) defaultValue(fields()[0]);
        record.method = fieldSetFlags()[1] ? this.method : (java.lang.String) defaultValue(fields()[1]);
        record.name = fieldSetFlags()[2] ? this.name : (java.lang.String) defaultValue(fields()[2]);
        record.value = fieldSetFlags()[3] ? this.value : (java.lang.Double) defaultValue(fields()[3]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy