org.opencb.biodata.models.metadata.Species Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package org.opencb.biodata.models.metadata;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Species 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\":\"Species\",\"namespace\":\"org.opencb.biodata.models.metadata\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Short species id. First letter from the first word + second word\\n e.g. hsapiens for homo sapiens, mmusculus for mus musculus,...\"},{\"name\":\"scientificName\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Full scrientific name. e.g. homo sapiens, mus musculus,...\",\"default\":null},{\"name\":\"taxonomyId\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"strain\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"assembly\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
/** Short species id. First letter from the first word + second word
e.g. hsapiens for homo sapiens, mmusculus for mus musculus,... */
private java.lang.String id;
/** Full scrientific name. e.g. homo sapiens, mus musculus,... */
private java.lang.String scientificName;
private java.lang.String taxonomyId;
private java.lang.String strain;
private java.lang.String assembly;
/**
* 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 Species() {}
/**
* All-args constructor.
*/
public Species(java.lang.String id, java.lang.String scientificName, java.lang.String taxonomyId, java.lang.String strain, java.lang.String assembly) {
this.id = id;
this.scientificName = scientificName;
this.taxonomyId = taxonomyId;
this.strain = strain;
this.assembly = assembly;
}
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 id;
case 1: return scientificName;
case 2: return taxonomyId;
case 3: return strain;
case 4: return assembly;
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: id = (java.lang.String)value$; break;
case 1: scientificName = (java.lang.String)value$; break;
case 2: taxonomyId = (java.lang.String)value$; break;
case 3: strain = (java.lang.String)value$; break;
case 4: assembly = (java.lang.String)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'id' field.
* Short species id. First letter from the first word + second word
e.g. hsapiens for homo sapiens, mmusculus for mus musculus,... */
public java.lang.String getId() {
return id;
}
/**
* Sets the value of the 'id' field.
* Short species id. First letter from the first word + second word
e.g. hsapiens for homo sapiens, mmusculus for mus musculus,... * @param value the value to set.
*/
public void setId(java.lang.String value) {
this.id = value;
}
/**
* Gets the value of the 'scientificName' field.
* Full scrientific name. e.g. homo sapiens, mus musculus,... */
public java.lang.String getScientificName() {
return scientificName;
}
/**
* Sets the value of the 'scientificName' field.
* Full scrientific name. e.g. homo sapiens, mus musculus,... * @param value the value to set.
*/
public void setScientificName(java.lang.String value) {
this.scientificName = value;
}
/**
* Gets the value of the 'taxonomyId' field.
*/
public java.lang.String getTaxonomyId() {
return taxonomyId;
}
/**
* Sets the value of the 'taxonomyId' field.
* @param value the value to set.
*/
public void setTaxonomyId(java.lang.String value) {
this.taxonomyId = value;
}
/**
* Gets the value of the 'strain' field.
*/
public java.lang.String getStrain() {
return strain;
}
/**
* Sets the value of the 'strain' field.
* @param value the value to set.
*/
public void setStrain(java.lang.String value) {
this.strain = value;
}
/**
* Gets the value of the 'assembly' field.
*/
public java.lang.String getAssembly() {
return assembly;
}
/**
* Sets the value of the 'assembly' field.
* @param value the value to set.
*/
public void setAssembly(java.lang.String value) {
this.assembly = value;
}
/** Creates a new Species RecordBuilder */
public static org.opencb.biodata.models.metadata.Species.Builder newBuilder() {
return new org.opencb.biodata.models.metadata.Species.Builder();
}
/** Creates a new Species RecordBuilder by copying an existing Builder */
public static org.opencb.biodata.models.metadata.Species.Builder newBuilder(org.opencb.biodata.models.metadata.Species.Builder other) {
return new org.opencb.biodata.models.metadata.Species.Builder(other);
}
/** Creates a new Species RecordBuilder by copying an existing Species instance */
public static org.opencb.biodata.models.metadata.Species.Builder newBuilder(org.opencb.biodata.models.metadata.Species other) {
return new org.opencb.biodata.models.metadata.Species.Builder(other);
}
/**
* RecordBuilder for Species instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
private java.lang.String id;
private java.lang.String scientificName;
private java.lang.String taxonomyId;
private java.lang.String strain;
private java.lang.String assembly;
/** Creates a new Builder */
private Builder() {
super(org.opencb.biodata.models.metadata.Species.SCHEMA$);
}
/** Creates a Builder by copying an existing Builder */
private Builder(org.opencb.biodata.models.metadata.Species.Builder other) {
super(other);
if (isValidValue(fields()[0], other.id)) {
this.id = data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.scientificName)) {
this.scientificName = data().deepCopy(fields()[1].schema(), other.scientificName);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.taxonomyId)) {
this.taxonomyId = data().deepCopy(fields()[2].schema(), other.taxonomyId);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.strain)) {
this.strain = data().deepCopy(fields()[3].schema(), other.strain);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.assembly)) {
this.assembly = data().deepCopy(fields()[4].schema(), other.assembly);
fieldSetFlags()[4] = true;
}
}
/** Creates a Builder by copying an existing Species instance */
private Builder(org.opencb.biodata.models.metadata.Species other) {
super(org.opencb.biodata.models.metadata.Species.SCHEMA$);
if (isValidValue(fields()[0], other.id)) {
this.id = data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.scientificName)) {
this.scientificName = data().deepCopy(fields()[1].schema(), other.scientificName);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.taxonomyId)) {
this.taxonomyId = data().deepCopy(fields()[2].schema(), other.taxonomyId);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.strain)) {
this.strain = data().deepCopy(fields()[3].schema(), other.strain);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.assembly)) {
this.assembly = data().deepCopy(fields()[4].schema(), other.assembly);
fieldSetFlags()[4] = true;
}
}
/** Gets the value of the 'id' field */
public java.lang.String getId() {
return id;
}
/** Sets the value of the 'id' field */
public org.opencb.biodata.models.metadata.Species.Builder setId(java.lang.String value) {
validate(fields()[0], value);
this.id = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'id' field has been set */
public boolean hasId() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'id' field */
public org.opencb.biodata.models.metadata.Species.Builder clearId() {
id = null;
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'scientificName' field */
public java.lang.String getScientificName() {
return scientificName;
}
/** Sets the value of the 'scientificName' field */
public org.opencb.biodata.models.metadata.Species.Builder setScientificName(java.lang.String value) {
validate(fields()[1], value);
this.scientificName = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'scientificName' field has been set */
public boolean hasScientificName() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'scientificName' field */
public org.opencb.biodata.models.metadata.Species.Builder clearScientificName() {
scientificName = null;
fieldSetFlags()[1] = false;
return this;
}
/** Gets the value of the 'taxonomyId' field */
public java.lang.String getTaxonomyId() {
return taxonomyId;
}
/** Sets the value of the 'taxonomyId' field */
public org.opencb.biodata.models.metadata.Species.Builder setTaxonomyId(java.lang.String value) {
validate(fields()[2], value);
this.taxonomyId = value;
fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'taxonomyId' field has been set */
public boolean hasTaxonomyId() {
return fieldSetFlags()[2];
}
/** Clears the value of the 'taxonomyId' field */
public org.opencb.biodata.models.metadata.Species.Builder clearTaxonomyId() {
taxonomyId = null;
fieldSetFlags()[2] = false;
return this;
}
/** Gets the value of the 'strain' field */
public java.lang.String getStrain() {
return strain;
}
/** Sets the value of the 'strain' field */
public org.opencb.biodata.models.metadata.Species.Builder setStrain(java.lang.String value) {
validate(fields()[3], value);
this.strain = value;
fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'strain' field has been set */
public boolean hasStrain() {
return fieldSetFlags()[3];
}
/** Clears the value of the 'strain' field */
public org.opencb.biodata.models.metadata.Species.Builder clearStrain() {
strain = null;
fieldSetFlags()[3] = false;
return this;
}
/** Gets the value of the 'assembly' field */
public java.lang.String getAssembly() {
return assembly;
}
/** Sets the value of the 'assembly' field */
public org.opencb.biodata.models.metadata.Species.Builder setAssembly(java.lang.String value) {
validate(fields()[4], value);
this.assembly = value;
fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'assembly' field has been set */
public boolean hasAssembly() {
return fieldSetFlags()[4];
}
/** Clears the value of the 'assembly' field */
public org.opencb.biodata.models.metadata.Species.Builder clearAssembly() {
assembly = null;
fieldSetFlags()[4] = false;
return this;
}
@Override
public Species build() {
try {
Species record = new Species();
record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
record.scientificName = fieldSetFlags()[1] ? this.scientificName : (java.lang.String) defaultValue(fields()[1]);
record.taxonomyId = fieldSetFlags()[2] ? this.taxonomyId : (java.lang.String) defaultValue(fields()[2]);
record.strain = fieldSetFlags()[3] ? this.strain : (java.lang.String) defaultValue(fields()[3]);
record.assembly = fieldSetFlags()[4] ? this.assembly : (java.lang.String) defaultValue(fields()[4]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}