/** * Autogenerated by Avro * * DO NOT EDIT DIRECTLY */ package com.xyz.schemas; import java.io.Serializable; @SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated public class Test extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord , Serializable{ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Test\",\"namespace\":\"com.xyz.schemas\",\"fields\":[{\"name\":\"uname\",\"type\":\"string\"},{\"name\":\"id\",\"type\":\"int\"}]}"); public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } @Deprecated public java.lang.CharSequence uname; @Deprecated public int id; /** * 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 Test() {} /** * All-args constructor. */ public Test(java.lang.CharSequence uname, java.lang.Integer id) { this.uname = uname; this.id = id; } 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 uname; case 1: return id; 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: uname = (java.lang.CharSequence)value$; break; case 1: id = (java.lang.Integer)value$; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** * Gets the value of the 'uname' field. */ public java.lang.CharSequence getUname() { return uname; } /** * Sets the value of the 'uname' field. * @param value the value to set. */ public void setUname(java.lang.CharSequence value) { this.uname = value; } /** * Gets the value of the 'id' field. */ public java.lang.Integer getId() { return id; } /** * Sets the value of the 'id' field. * @param value the value to set. */ public void setId(java.lang.Integer value) { this.id = value; } /** Creates a new Test RecordBuilder */ public static com.xyz.schemas.Test.Builder newBuilder() { return new com.xyz.schemas.Test.Builder(); } /** Creates a new Test RecordBuilder by copying an existing Builder */ public static com.xyz.schemas.Test.Builder newBuilder(com.xyz.schemas.Test.Builder other) { return new com.xyz.schemas.Test.Builder(other); } /** Creates a new Test RecordBuilder by copying an existing Test instance */ public static com.xyz.schemas.Test.Builder newBuilder(com.xyz.schemas.Test other) { return new com.xyz.schemas.Test.Builder(other); } /** * RecordBuilder for Test instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase implements org.apache.avro.data.RecordBuilder { private java.lang.CharSequence uname; private int id; /** Creates a new Builder */ private Builder() { super(com.xyz.schemas.Test.SCHEMA$); } /** Creates a Builder by copying an existing Builder */ private Builder(com.xyz.schemas.Test.Builder other) { super(other); if (isValidValue(fields()[0], other.uname)) { this.uname = data().deepCopy(fields()[0].schema(), other.uname); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.id)) { this.id = data().deepCopy(fields()[1].schema(), other.id); fieldSetFlags()[1] = true; } } /** Creates a Builder by copying an existing Test instance */ private Builder(com.xyz.schemas.Test other) { super(com.xyz.schemas.Test.SCHEMA$); if (isValidValue(fields()[0], other.uname)) { this.uname = data().deepCopy(fields()[0].schema(), other.uname); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.id)) { this.id = data().deepCopy(fields()[1].schema(), other.id); fieldSetFlags()[1] = true; } } /** Gets the value of the 'uname' field */ public java.lang.CharSequence getUname() { return uname; } /** Sets the value of the 'uname' field */ public com.xyz.schemas.Test.Builder setUname(java.lang.CharSequence value) { validate(fields()[0], value); this.uname = value; fieldSetFlags()[0] = true; return this; } /** Checks whether the 'uname' field has been set */ public boolean hasUname() { return fieldSetFlags()[0]; } /** Clears the value of the 'uname' field */ public com.xyz.schemas.Test.Builder clearUname() { uname = null; fieldSetFlags()[0] = false; return this; } /** Gets the value of the 'id' field */ public java.lang.Integer getId() { return id; } /** Sets the value of the 'id' field */ public com.xyz.schemas.Test.Builder setId(int value) { validate(fields()[1], value); this.id = value; fieldSetFlags()[1] = true; return this; } /** Checks whether the 'id' field has been set */ public boolean hasId() { return fieldSetFlags()[1]; } /** Clears the value of the 'id' field */ public com.xyz.schemas.Test.Builder clearId() { fieldSetFlags()[1] = false; return this; } @Override public Test build() { try { Test record = new Test(); record.uname = fieldSetFlags()[0] ? this.uname : (java.lang.CharSequence) defaultValue(fields()[0]); record.id = fieldSetFlags()[1] ? this.id : (java.lang.Integer) defaultValue(fields()[1]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } }