org.opencb.biodata.models.variant.avro.AdditionalAttribute 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 AdditionalAttribute 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\":\"AdditionalAttribute\",\"namespace\":\"org.opencb.biodata.models.variant.avro\",\"fields\":[{\"name\":\"attribute\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
private java.util.Map attribute;
/**
* 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 AdditionalAttribute() {}
/**
* All-args constructor.
*/
public AdditionalAttribute(java.util.Map attribute) {
this.attribute = attribute;
}
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 attribute;
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: attribute = (java.util.Map)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'attribute' field.
*/
public java.util.Map getAttribute() {
return attribute;
}
/**
* Sets the value of the 'attribute' field.
* @param value the value to set.
*/
public void setAttribute(java.util.Map value) {
this.attribute = value;
}
/** Creates a new AdditionalAttribute RecordBuilder */
public static org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder newBuilder() {
return new org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder();
}
/** Creates a new AdditionalAttribute RecordBuilder by copying an existing Builder */
public static org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder newBuilder(org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder other) {
return new org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder(other);
}
/** Creates a new AdditionalAttribute RecordBuilder by copying an existing AdditionalAttribute instance */
public static org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder newBuilder(org.opencb.biodata.models.variant.avro.AdditionalAttribute other) {
return new org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder(other);
}
/**
* RecordBuilder for AdditionalAttribute instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
private java.util.Map attribute;
/** Creates a new Builder */
private Builder() {
super(org.opencb.biodata.models.variant.avro.AdditionalAttribute.SCHEMA$);
}
/** Creates a Builder by copying an existing Builder */
private Builder(org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder other) {
super(other);
if (isValidValue(fields()[0], other.attribute)) {
this.attribute = data().deepCopy(fields()[0].schema(), other.attribute);
fieldSetFlags()[0] = true;
}
}
/** Creates a Builder by copying an existing AdditionalAttribute instance */
private Builder(org.opencb.biodata.models.variant.avro.AdditionalAttribute other) {
super(org.opencb.biodata.models.variant.avro.AdditionalAttribute.SCHEMA$);
if (isValidValue(fields()[0], other.attribute)) {
this.attribute = data().deepCopy(fields()[0].schema(), other.attribute);
fieldSetFlags()[0] = true;
}
}
/** Gets the value of the 'attribute' field */
public java.util.Map getAttribute() {
return attribute;
}
/** Sets the value of the 'attribute' field */
public org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder setAttribute(java.util.Map value) {
validate(fields()[0], value);
this.attribute = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'attribute' field has been set */
public boolean hasAttribute() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'attribute' field */
public org.opencb.biodata.models.variant.avro.AdditionalAttribute.Builder clearAttribute() {
attribute = null;
fieldSetFlags()[0] = false;
return this;
}
@Override
public AdditionalAttribute build() {
try {
AdditionalAttribute record = new AdditionalAttribute();
record.attribute = fieldSetFlags()[0] ? this.attribute : (java.util.Map) defaultValue(fields()[0]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}