/*** Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY*/
packagecom.linux.huhx.avro;importorg.apache.avro.specific.SpecificData;importorg.apache.avro.message.BinaryMessageEncoder;importorg.apache.avro.message.BinaryMessageDecoder;importorg.apache.avro.message.SchemaStore;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGeneratedpublic class User extends org.apache.avro.specific.SpecificRecordBase implementsorg.apache.avro.specific.SpecificRecord {private static final long serialVersionUID = -1677175913369996238L;public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"User\",\"namespace\":\"com.linux.huhx.avro\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"favorite_number\",\"type\":[\"int\",\"null\"]},{\"name\":\"favorite_color\",\"type\":[\"string\",\"null\"]}]}");public static org.apache.avro.Schema getClassSchema() { returnSCHEMA$; }private static SpecificData MODEL$ = newSpecificData();private static final BinaryMessageEncoder ENCODER =
new BinaryMessageEncoder(MODEL$, SCHEMA$);private static final BinaryMessageDecoder DECODER =
new BinaryMessageDecoder(MODEL$, SCHEMA$);/*** Return the BinaryMessageDecoder instance used by this class.*/
public static BinaryMessageDecodergetDecoder() {returnDECODER;
}/*** Create a new BinaryMessageDecoder instance for this class that uses the specified {@linkSchemaStore}.
*@paramresolver a {@linkSchemaStore} used to find schemas by fingerprint*/
public static BinaryMessageDecodercreateDecoder(SchemaStore resolver) {return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
}/**Serializes this User to a ByteBuffer.*/
public java.nio.ByteBuffer toByteBuffer() throwsjava.io.IOException {return ENCODER.encode(this);
}/**Deserializes a User from a ByteBuffer.*/
public staticUser fromByteBuffer(
java.nio.ByteBuffer b)throwsjava.io.IOException {returnDECODER.decode(b);
}
@Deprecatedpublicjava.lang.CharSequence name;
@Deprecatedpublicjava.lang.Integer favorite_number;
@Deprecatedpublicjava.lang.CharSequence favorite_color;/*** 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()
.*/
publicUser() {}/*** All-args constructor.
*@paramname The new value for name
*@paramfavorite_number The new value for favorite_number
*@paramfavorite_color The new value for favorite_color*/
publicUser(java.lang.CharSequence name, java.lang.Integer favorite_number, java.lang.CharSequence favorite_color) {this.name =name;this.favorite_number =favorite_number;this.favorite_color =favorite_color;
}public org.apache.avro.Schema getSchema() { returnSCHEMA$; }//Used by DatumWriter. Applications should not call.
public java.lang.Object get(intfield$) {switch(field$) {case 0: returnname;case 1: returnfavorite_number;case 2: returnfavorite_color;default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}//Used by DatumReader. Applications should not call.
@SuppressWarnings(value="unchecked")public void put(intfield$, java.lang.Object value$) {switch(field$) {case 0: name = (java.lang.CharSequence)value$; break;case 1: favorite_number = (java.lang.Integer)value$; break;case 2: favorite_color = (java.lang.CharSequence)value$; break;default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}/*** Gets the value of the 'name' field.
*@returnThe value of the 'name' field.*/
publicjava.lang.CharSequence getName() {returnname;
}/*** Sets the value of the 'name' field.
*@paramvalue the value to set.*/
public voidsetName(java.lang.CharSequence value) {this.name =value;
}/*** Gets the value of the 'favorite_number' field.
*@returnThe value of the 'favorite_number' field.*/
publicjava.lang.Integer getFavoriteNumber() {returnfavorite_number;
}/*** Sets the value of the 'favorite_number' field.
*@paramvalue the value to set.*/
public voidsetFavoriteNumber(java.lang.Integer value) {this.favorite_number =value;
}/*** Gets the value of the 'favorite_color' field.
*@returnThe value of the 'favorite_color' field.*/
publicjava.lang.CharSequence getFavoriteColor() {returnfavorite_color;
}/*** Sets the value of the 'favorite_color' field.
*@paramvalue the value to set.*/
public voidsetFavoriteColor(java.lang.CharSequence value) {this.favorite_color =value;
}/*** Creates a new User RecordBuilder.
*@returnA new User RecordBuilder*/
public staticcom.linux.huhx.avro.User.Builder newBuilder() {return newcom.linux.huhx.avro.User.Builder();
}/*** Creates a new User RecordBuilder by copying an existing Builder.
*@paramother The existing builder to copy.
*@returnA new User RecordBuilder*/
public staticcom.linux.huhx.avro.User.Builder newBuilder(com.linux.huhx.avro.User.Builder other) {return newcom.linux.huhx.avro.User.Builder(other);
}/*** Creates a new User RecordBuilder by copying an existing User instance.
*@paramother The existing instance to copy.
*@returnA new User RecordBuilder*/
public staticcom.linux.huhx.avro.User.Builder newBuilder(com.linux.huhx.avro.User other) {return newcom.linux.huhx.avro.User.Builder(other);
}/*** RecordBuilder for User instances.*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder{privatejava.lang.CharSequence name;privatejava.lang.Integer favorite_number;privatejava.lang.CharSequence favorite_color;/**Creates a new Builder*/
privateBuilder() {super(SCHEMA$);
}/*** Creates a Builder by copying an existing Builder.
*@paramother The existing Builder to copy.*/
privateBuilder(com.linux.huhx.avro.User.Builder other) {super(other);if (isValidValue(fields()[0], other.name)) {this.name = data().deepCopy(fields()[0].schema(), other.name);
fieldSetFlags()[0] = true;
}if (isValidValue(fields()[1], other.favorite_number)) {this.favorite_number = data().deepCopy(fields()[1].schema(), other.favorite_number);
fieldSetFlags()[1] = true;
}if (isValidValue(fields()[2], other.favorite_color)) {this.favorite_color = data().deepCopy(fields()[2].schema(), other.favorite_color);
fieldSetFlags()[2] = true;
}
}/*** Creates a Builder by copying an existing User instance
*@paramother The existing instance to copy.*/
privateBuilder(com.linux.huhx.avro.User other) {super(SCHEMA$);if (isValidValue(fields()[0], other.name)) {this.name = data().deepCopy(fields()[0].schema(), other.name);
fieldSetFlags()[0] = true;
}if (isValidValue(fields()[1], other.favorite_number)) {this.favorite_number = data().deepCopy(fields()[1].schema(), other.favorite_number);
fieldSetFlags()[1] = true;
}if (isValidValue(fields()[2], other.favorite_color)) {this.favorite_color = data().deepCopy(fields()[2].schema(), other.favorite_color);
fieldSetFlags()[2] = true;
}
}/*** Gets the value of the 'name' field.
*@returnThe value.*/
publicjava.lang.CharSequence getName() {returnname;
}/*** Sets the value of the 'name' field.
*@paramvalue The value of 'name'.
*@returnThis builder.*/
publiccom.linux.huhx.avro.User.Builder setName(java.lang.CharSequence value) {
validate(fields()[0], value);this.name =value;
fieldSetFlags()[0] = true;return this;
}/*** Checks whether the 'name' field has been set.
*@returnTrue if the 'name' field has been set, false otherwise.*/
public booleanhasName() {return fieldSetFlags()[0];
}/*** Clears the value of the 'name' field.
*@returnThis builder.*/
publiccom.linux.huhx.avro.User.Builder clearName() {
name= null;
fieldSetFlags()[0] = false;return this;
}/*** Gets the value of the 'favorite_number' field.
*@returnThe value.*/
publicjava.lang.Integer getFavoriteNumber() {returnfavorite_number;
}/*** Sets the value of the 'favorite_number' field.
*@paramvalue The value of 'favorite_number'.
*@returnThis builder.*/
publiccom.linux.huhx.avro.User.Builder setFavoriteNumber(java.lang.Integer value) {
validate(fields()[1], value);this.favorite_number =value;
fieldSetFlags()[1] = true;return this;
}/*** Checks whether the 'favorite_number' field has been set.
*@returnTrue if the 'favorite_number' field has been set, false otherwise.*/
public booleanhasFavoriteNumber() {return fieldSetFlags()[1];
}/*** Clears the value of the 'favorite_number' field.
*@returnThis builder.*/
publiccom.linux.huhx.avro.User.Builder clearFavoriteNumber() {
favorite_number= null;
fieldSetFlags()[1] = false;return this;
}/*** Gets the value of the 'favorite_color' field.
*@returnThe value.*/
publicjava.lang.CharSequence getFavoriteColor() {returnfavorite_color;
}/*** Sets the value of the 'favorite_color' field.
*@paramvalue The value of 'favorite_color'.
*@returnThis builder.*/
publiccom.linux.huhx.avro.User.Builder setFavoriteColor(java.lang.CharSequence value) {
validate(fields()[2], value);this.favorite_color =value;
fieldSetFlags()[2] = true;return this;
}/*** Checks whether the 'favorite_color' field has been set.
*@returnTrue if the 'favorite_color' field has been set, false otherwise.*/
public booleanhasFavoriteColor() {return fieldSetFlags()[2];
}/*** Clears the value of the 'favorite_color' field.
*@returnThis builder.*/
publiccom.linux.huhx.avro.User.Builder clearFavoriteColor() {
favorite_color= null;
fieldSetFlags()[2] = false;return this;
}
@Override
@SuppressWarnings("unchecked")publicUser build() {try{
User record= newUser();
record.name= fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]);
record.favorite_number= fieldSetFlags()[1] ? this.favorite_number : (java.lang.Integer) defaultValue(fields()[1]);
record.favorite_color= fieldSetFlags()[2] ? this.favorite_color : (java.lang.CharSequence) defaultValue(fields()[2]);returnrecord;
}catch(java.lang.Exception e) {throw neworg.apache.avro.AvroRuntimeException(e);
}
}
}
@SuppressWarnings("unchecked")private static final org.apache.avro.io.DatumWriterWRITER$= (org.apache.avro.io.DatumWriter)MODEL$.createDatumWriter(SCHEMA$);
@Overridepublic voidwriteExternal(java.io.ObjectOutput out)throwsjava.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")private static final org.apache.avro.io.DatumReaderREADER$= (org.apache.avro.io.DatumReader)MODEL$.createDatumReader(SCHEMA$);
@Overridepublic voidreadExternal(java.io.ObjectInput in)throwsjava.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
}