Created
September 14, 2014 18:42
-
-
Save rishav-rohit/2352c44d19875e2ca5e5 to your computer and use it in GitHub Desktop.
Avro Java schema file student_marks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Autogenerated by Avro | |
* | |
* DO NOT EDIT DIRECTLY | |
*/ | |
package com.rishav.avro; | |
@SuppressWarnings("all") | |
@org.apache.avro.specific.AvroGenerated | |
public class student_marks 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\":\"student_marks\",\"namespace\":\"com.rishav.avro\",\"fields\":[{\"name\":\"student_id\",\"type\":\"int\"},{\"name\":\"subject_id\",\"type\":\"int\"},{\"name\":\"marks\",\"type\":\"int\"}]}"); | |
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } | |
@Deprecated public int student_id; | |
@Deprecated public int subject_id; | |
@Deprecated public int marks; | |
/** | |
* Default constructor. Note that this does not initialize fields | |
* to their default values from the schema. If that is desired then | |
* one should use {@link \#newBuilder()}. | |
*/ | |
public student_marks() {} | |
/** | |
* All-args constructor. | |
*/ | |
public student_marks(java.lang.Integer student_id, java.lang.Integer subject_id, java.lang.Integer marks) { | |
this.student_id = student_id; | |
this.subject_id = subject_id; | |
this.marks = marks; | |
} | |
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 student_id; | |
case 1: return subject_id; | |
case 2: return marks; | |
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: student_id = (java.lang.Integer)value$; break; | |
case 1: subject_id = (java.lang.Integer)value$; break; | |
case 2: marks = (java.lang.Integer)value$; break; | |
default: throw new org.apache.avro.AvroRuntimeException("Bad index"); | |
} | |
} | |
/** | |
* Gets the value of the 'student_id' field. | |
*/ | |
public java.lang.Integer getStudentId() { | |
return student_id; | |
} | |
/** | |
* Sets the value of the 'student_id' field. | |
* @param value the value to set. | |
*/ | |
public void setStudentId(java.lang.Integer value) { | |
this.student_id = value; | |
} | |
/** | |
* Gets the value of the 'subject_id' field. | |
*/ | |
public java.lang.Integer getSubjectId() { | |
return subject_id; | |
} | |
/** | |
* Sets the value of the 'subject_id' field. | |
* @param value the value to set. | |
*/ | |
public void setSubjectId(java.lang.Integer value) { | |
this.subject_id = value; | |
} | |
/** | |
* Gets the value of the 'marks' field. | |
*/ | |
public java.lang.Integer getMarks() { | |
return marks; | |
} | |
/** | |
* Sets the value of the 'marks' field. | |
* @param value the value to set. | |
*/ | |
public void setMarks(java.lang.Integer value) { | |
this.marks = value; | |
} | |
/** Creates a new student_marks RecordBuilder */ | |
public static com.rishav.avro.student_marks.Builder newBuilder() { | |
return new com.rishav.avro.student_marks.Builder(); | |
} | |
/** Creates a new student_marks RecordBuilder by copying an existing Builder */ | |
public static com.rishav.avro.student_marks.Builder newBuilder(com.rishav.avro.student_marks.Builder other) { | |
return new com.rishav.avro.student_marks.Builder(other); | |
} | |
/** Creates a new student_marks RecordBuilder by copying an existing student_marks instance */ | |
public static com.rishav.avro.student_marks.Builder newBuilder(com.rishav.avro.student_marks other) { | |
return new com.rishav.avro.student_marks.Builder(other); | |
} | |
/** | |
* RecordBuilder for student_marks instances. | |
*/ | |
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<student_marks> | |
implements org.apache.avro.data.RecordBuilder<student_marks> { | |
private int student_id; | |
private int subject_id; | |
private int marks; | |
/** Creates a new Builder */ | |
private Builder() { | |
super(com.rishav.avro.student_marks.SCHEMA$); | |
} | |
/** Creates a Builder by copying an existing Builder */ | |
private Builder(com.rishav.avro.student_marks.Builder other) { | |
super(other); | |
if (isValidValue(fields()[0], other.student_id)) { | |
this.student_id = data().deepCopy(fields()[0].schema(), other.student_id); | |
fieldSetFlags()[0] = true; | |
} | |
if (isValidValue(fields()[1], other.subject_id)) { | |
this.subject_id = data().deepCopy(fields()[1].schema(), other.subject_id); | |
fieldSetFlags()[1] = true; | |
} | |
if (isValidValue(fields()[2], other.marks)) { | |
this.marks = data().deepCopy(fields()[2].schema(), other.marks); | |
fieldSetFlags()[2] = true; | |
} | |
} | |
/** Creates a Builder by copying an existing student_marks instance */ | |
private Builder(com.rishav.avro.student_marks other) { | |
super(com.rishav.avro.student_marks.SCHEMA$); | |
if (isValidValue(fields()[0], other.student_id)) { | |
this.student_id = data().deepCopy(fields()[0].schema(), other.student_id); | |
fieldSetFlags()[0] = true; | |
} | |
if (isValidValue(fields()[1], other.subject_id)) { | |
this.subject_id = data().deepCopy(fields()[1].schema(), other.subject_id); | |
fieldSetFlags()[1] = true; | |
} | |
if (isValidValue(fields()[2], other.marks)) { | |
this.marks = data().deepCopy(fields()[2].schema(), other.marks); | |
fieldSetFlags()[2] = true; | |
} | |
} | |
/** Gets the value of the 'student_id' field */ | |
public java.lang.Integer getStudentId() { | |
return student_id; | |
} | |
/** Sets the value of the 'student_id' field */ | |
public com.rishav.avro.student_marks.Builder setStudentId(int value) { | |
validate(fields()[0], value); | |
this.student_id = value; | |
fieldSetFlags()[0] = true; | |
return this; | |
} | |
/** Checks whether the 'student_id' field has been set */ | |
public boolean hasStudentId() { | |
return fieldSetFlags()[0]; | |
} | |
/** Clears the value of the 'student_id' field */ | |
public com.rishav.avro.student_marks.Builder clearStudentId() { | |
fieldSetFlags()[0] = false; | |
return this; | |
} | |
/** Gets the value of the 'subject_id' field */ | |
public java.lang.Integer getSubjectId() { | |
return subject_id; | |
} | |
/** Sets the value of the 'subject_id' field */ | |
public com.rishav.avro.student_marks.Builder setSubjectId(int value) { | |
validate(fields()[1], value); | |
this.subject_id = value; | |
fieldSetFlags()[1] = true; | |
return this; | |
} | |
/** Checks whether the 'subject_id' field has been set */ | |
public boolean hasSubjectId() { | |
return fieldSetFlags()[1]; | |
} | |
/** Clears the value of the 'subject_id' field */ | |
public com.rishav.avro.student_marks.Builder clearSubjectId() { | |
fieldSetFlags()[1] = false; | |
return this; | |
} | |
/** Gets the value of the 'marks' field */ | |
public java.lang.Integer getMarks() { | |
return marks; | |
} | |
/** Sets the value of the 'marks' field */ | |
public com.rishav.avro.student_marks.Builder setMarks(int value) { | |
validate(fields()[2], value); | |
this.marks = value; | |
fieldSetFlags()[2] = true; | |
return this; | |
} | |
/** Checks whether the 'marks' field has been set */ | |
public boolean hasMarks() { | |
return fieldSetFlags()[2]; | |
} | |
/** Clears the value of the 'marks' field */ | |
public com.rishav.avro.student_marks.Builder clearMarks() { | |
fieldSetFlags()[2] = false; | |
return this; | |
} | |
@Override | |
public student_marks build() { | |
try { | |
student_marks record = new student_marks(); | |
record.student_id = fieldSetFlags()[0] ? this.student_id : (java.lang.Integer) defaultValue(fields()[0]); | |
record.subject_id = fieldSetFlags()[1] ? this.subject_id : (java.lang.Integer) defaultValue(fields()[1]); | |
record.marks = fieldSetFlags()[2] ? this.marks : (java.lang.Integer) defaultValue(fields()[2]); | |
return record; | |
} catch (Exception e) { | |
throw new org.apache.avro.AvroRuntimeException(e); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment