com.yahoo.bullet.dsl.DummyAvro Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bullet-dsl Show documentation
Show all versions of bullet-dsl Show documentation
This library provides a code-less way to get your data into Bullet without
The newest version!
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package com.yahoo.bullet.dsl;
import org.apache.avro.generic.GenericArray;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.util.Utf8;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;
@org.apache.avro.specific.AvroGenerated
public class DummyAvro extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
private static final long serialVersionUID = 2508964835380115058L;
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"DummyAvro\",\"namespace\":\"com.yahoo.bullet.dsl\",\"fields\":[{\"name\":\"myInt\",\"type\":\"int\"},{\"name\":\"myLong\",\"type\":\"long\"},{\"name\":\"myFloat\",\"type\":\"float\"},{\"name\":\"myDouble\",\"type\":\"double\"},{\"name\":\"myBool\",\"type\":\"boolean\"},{\"name\":\"myString\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"myIntList\",\"type\":[{\"type\":\"array\",\"items\":\"int\"},\"null\"]},{\"name\":\"myStringMap\",\"type\":[{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"myBytes\",\"type\":[\"bytes\",\"null\"]},{\"name\":\"myDummyAvro\",\"type\":[\"DummyAvro\",\"null\"]}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
private static SpecificData MODEL$ = new SpecificData();
private static final BinaryMessageEncoder ENCODER =
new BinaryMessageEncoder(MODEL$, SCHEMA$);
private static final BinaryMessageDecoder DECODER =
new BinaryMessageDecoder(MODEL$, SCHEMA$);
/**
* Return the BinaryMessageEncoder instance used by this class.
* @return the message encoder used by this class
*/
public static BinaryMessageEncoder getEncoder() {
return ENCODER;
}
/**
* Return the BinaryMessageDecoder instance used by this class.
* @return the message decoder used by this class
*/
public static BinaryMessageDecoder getDecoder() {
return DECODER;
}
/**
* Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
* @param resolver a {@link SchemaStore} used to find schemas by fingerprint
* @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
*/
public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
}
/**
* Serializes this DummyAvro to a ByteBuffer.
* @return a buffer holding the serialized data for this instance
* @throws java.io.IOException if this instance could not be serialized
*/
public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
return ENCODER.encode(this);
}
/**
* Deserializes a DummyAvro from a ByteBuffer.
* @param b a byte buffer holding serialized data for an instance of this class
* @return a DummyAvro instance decoded from the given buffer
* @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
*/
public static DummyAvro fromByteBuffer(
java.nio.ByteBuffer b) throws java.io.IOException {
return DECODER.decode(b);
}
@Deprecated public int myInt;
@Deprecated public long myLong;
@Deprecated public float myFloat;
@Deprecated public double myDouble;
@Deprecated public boolean myBool;
@Deprecated public java.lang.String myString;
@Deprecated public java.util.List myIntList;
@Deprecated public java.util.Map myStringMap;
@Deprecated public java.nio.ByteBuffer myBytes;
@Deprecated public com.yahoo.bullet.dsl.DummyAvro myDummyAvro;
/**
* 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 DummyAvro() {}
/**
* All-args constructor.
* @param myInt The new value for myInt
* @param myLong The new value for myLong
* @param myFloat The new value for myFloat
* @param myDouble The new value for myDouble
* @param myBool The new value for myBool
* @param myString The new value for myString
* @param myIntList The new value for myIntList
* @param myStringMap The new value for myStringMap
* @param myBytes The new value for myBytes
* @param myDummyAvro The new value for myDummyAvro
*/
public DummyAvro(java.lang.Integer myInt, java.lang.Long myLong, java.lang.Float myFloat, java.lang.Double myDouble, java.lang.Boolean myBool, java.lang.String myString, java.util.List myIntList, java.util.Map myStringMap, java.nio.ByteBuffer myBytes, com.yahoo.bullet.dsl.DummyAvro myDummyAvro) {
this.myInt = myInt;
this.myLong = myLong;
this.myFloat = myFloat;
this.myDouble = myDouble;
this.myBool = myBool;
this.myString = myString;
this.myIntList = myIntList;
this.myStringMap = myStringMap;
this.myBytes = myBytes;
this.myDummyAvro = myDummyAvro;
}
public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
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 myInt;
case 1: return myLong;
case 2: return myFloat;
case 3: return myDouble;
case 4: return myBool;
case 5: return myString;
case 6: return myIntList;
case 7: return myStringMap;
case 8: return myBytes;
case 9: return myDummyAvro;
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: myInt = (java.lang.Integer)value$; break;
case 1: myLong = (java.lang.Long)value$; break;
case 2: myFloat = (java.lang.Float)value$; break;
case 3: myDouble = (java.lang.Double)value$; break;
case 4: myBool = (java.lang.Boolean)value$; break;
case 5: myString = value$ != null ? value$.toString() : null; break;
case 6: myIntList = (java.util.List)value$; break;
case 7: myStringMap = (java.util.Map)value$; break;
case 8: myBytes = (java.nio.ByteBuffer)value$; break;
case 9: myDummyAvro = (com.yahoo.bullet.dsl.DummyAvro)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'myInt' field.
* @return The value of the 'myInt' field.
*/
public int getMyInt() {
return myInt;
}
/**
* Sets the value of the 'myInt' field.
* @param value the value to set.
*/
public void setMyInt(int value) {
this.myInt = value;
}
/**
* Gets the value of the 'myLong' field.
* @return The value of the 'myLong' field.
*/
public long getMyLong() {
return myLong;
}
/**
* Sets the value of the 'myLong' field.
* @param value the value to set.
*/
public void setMyLong(long value) {
this.myLong = value;
}
/**
* Gets the value of the 'myFloat' field.
* @return The value of the 'myFloat' field.
*/
public float getMyFloat() {
return myFloat;
}
/**
* Sets the value of the 'myFloat' field.
* @param value the value to set.
*/
public void setMyFloat(float value) {
this.myFloat = value;
}
/**
* Gets the value of the 'myDouble' field.
* @return The value of the 'myDouble' field.
*/
public double getMyDouble() {
return myDouble;
}
/**
* Sets the value of the 'myDouble' field.
* @param value the value to set.
*/
public void setMyDouble(double value) {
this.myDouble = value;
}
/**
* Gets the value of the 'myBool' field.
* @return The value of the 'myBool' field.
*/
public boolean getMyBool() {
return myBool;
}
/**
* Sets the value of the 'myBool' field.
* @param value the value to set.
*/
public void setMyBool(boolean value) {
this.myBool = value;
}
/**
* Gets the value of the 'myString' field.
* @return The value of the 'myString' field.
*/
public java.lang.String getMyString() {
return myString;
}
/**
* Sets the value of the 'myString' field.
* @param value the value to set.
*/
public void setMyString(java.lang.String value) {
this.myString = value;
}
/**
* Gets the value of the 'myIntList' field.
* @return The value of the 'myIntList' field.
*/
public java.util.List getMyIntList() {
return myIntList;
}
/**
* Sets the value of the 'myIntList' field.
* @param value the value to set.
*/
public void setMyIntList(java.util.List value) {
this.myIntList = value;
}
/**
* Gets the value of the 'myStringMap' field.
* @return The value of the 'myStringMap' field.
*/
public java.util.Map getMyStringMap() {
return myStringMap;
}
/**
* Sets the value of the 'myStringMap' field.
* @param value the value to set.
*/
public void setMyStringMap(java.util.Map value) {
this.myStringMap = value;
}
/**
* Gets the value of the 'myBytes' field.
* @return The value of the 'myBytes' field.
*/
public java.nio.ByteBuffer getMyBytes() {
return myBytes;
}
/**
* Sets the value of the 'myBytes' field.
* @param value the value to set.
*/
public void setMyBytes(java.nio.ByteBuffer value) {
this.myBytes = value;
}
/**
* Gets the value of the 'myDummyAvro' field.
* @return The value of the 'myDummyAvro' field.
*/
public com.yahoo.bullet.dsl.DummyAvro getMyDummyAvro() {
return myDummyAvro;
}
/**
* Sets the value of the 'myDummyAvro' field.
* @param value the value to set.
*/
public void setMyDummyAvro(com.yahoo.bullet.dsl.DummyAvro value) {
this.myDummyAvro = value;
}
/**
* Creates a new DummyAvro RecordBuilder.
* @return A new DummyAvro RecordBuilder
*/
public static com.yahoo.bullet.dsl.DummyAvro.Builder newBuilder() {
return new com.yahoo.bullet.dsl.DummyAvro.Builder();
}
/**
* Creates a new DummyAvro RecordBuilder by copying an existing Builder.
* @param other The existing builder to copy.
* @return A new DummyAvro RecordBuilder
*/
public static com.yahoo.bullet.dsl.DummyAvro.Builder newBuilder(com.yahoo.bullet.dsl.DummyAvro.Builder other) {
if (other == null) {
return new com.yahoo.bullet.dsl.DummyAvro.Builder();
} else {
return new com.yahoo.bullet.dsl.DummyAvro.Builder(other);
}
}
/**
* Creates a new DummyAvro RecordBuilder by copying an existing DummyAvro instance.
* @param other The existing instance to copy.
* @return A new DummyAvro RecordBuilder
*/
public static com.yahoo.bullet.dsl.DummyAvro.Builder newBuilder(com.yahoo.bullet.dsl.DummyAvro other) {
if (other == null) {
return new com.yahoo.bullet.dsl.DummyAvro.Builder();
} else {
return new com.yahoo.bullet.dsl.DummyAvro.Builder(other);
}
}
/**
* RecordBuilder for DummyAvro instances.
*/
@org.apache.avro.specific.AvroGenerated
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
private int myInt;
private long myLong;
private float myFloat;
private double myDouble;
private boolean myBool;
private java.lang.String myString;
private java.util.List myIntList;
private java.util.Map myStringMap;
private java.nio.ByteBuffer myBytes;
private com.yahoo.bullet.dsl.DummyAvro myDummyAvro;
private com.yahoo.bullet.dsl.DummyAvro.Builder myDummyAvroBuilder;
/** Creates a new Builder */
private Builder() {
super(SCHEMA$);
}
/**
* Creates a Builder by copying an existing Builder.
* @param other The existing Builder to copy.
*/
private Builder(com.yahoo.bullet.dsl.DummyAvro.Builder other) {
super(other);
if (isValidValue(fields()[0], other.myInt)) {
this.myInt = data().deepCopy(fields()[0].schema(), other.myInt);
fieldSetFlags()[0] = other.fieldSetFlags()[0];
}
if (isValidValue(fields()[1], other.myLong)) {
this.myLong = data().deepCopy(fields()[1].schema(), other.myLong);
fieldSetFlags()[1] = other.fieldSetFlags()[1];
}
if (isValidValue(fields()[2], other.myFloat)) {
this.myFloat = data().deepCopy(fields()[2].schema(), other.myFloat);
fieldSetFlags()[2] = other.fieldSetFlags()[2];
}
if (isValidValue(fields()[3], other.myDouble)) {
this.myDouble = data().deepCopy(fields()[3].schema(), other.myDouble);
fieldSetFlags()[3] = other.fieldSetFlags()[3];
}
if (isValidValue(fields()[4], other.myBool)) {
this.myBool = data().deepCopy(fields()[4].schema(), other.myBool);
fieldSetFlags()[4] = other.fieldSetFlags()[4];
}
if (isValidValue(fields()[5], other.myString)) {
this.myString = data().deepCopy(fields()[5].schema(), other.myString);
fieldSetFlags()[5] = other.fieldSetFlags()[5];
}
if (isValidValue(fields()[6], other.myIntList)) {
this.myIntList = data().deepCopy(fields()[6].schema(), other.myIntList);
fieldSetFlags()[6] = other.fieldSetFlags()[6];
}
if (isValidValue(fields()[7], other.myStringMap)) {
this.myStringMap = data().deepCopy(fields()[7].schema(), other.myStringMap);
fieldSetFlags()[7] = other.fieldSetFlags()[7];
}
if (isValidValue(fields()[8], other.myBytes)) {
this.myBytes = data().deepCopy(fields()[8].schema(), other.myBytes);
fieldSetFlags()[8] = other.fieldSetFlags()[8];
}
if (isValidValue(fields()[9], other.myDummyAvro)) {
this.myDummyAvro = data().deepCopy(fields()[9].schema(), other.myDummyAvro);
fieldSetFlags()[9] = other.fieldSetFlags()[9];
}
if (other.hasMyDummyAvroBuilder()) {
this.myDummyAvroBuilder = com.yahoo.bullet.dsl.DummyAvro.newBuilder(other.getMyDummyAvroBuilder());
}
}
/**
* Creates a Builder by copying an existing DummyAvro instance
* @param other The existing instance to copy.
*/
private Builder(com.yahoo.bullet.dsl.DummyAvro other) {
super(SCHEMA$);
if (isValidValue(fields()[0], other.myInt)) {
this.myInt = data().deepCopy(fields()[0].schema(), other.myInt);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.myLong)) {
this.myLong = data().deepCopy(fields()[1].schema(), other.myLong);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.myFloat)) {
this.myFloat = data().deepCopy(fields()[2].schema(), other.myFloat);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.myDouble)) {
this.myDouble = data().deepCopy(fields()[3].schema(), other.myDouble);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.myBool)) {
this.myBool = data().deepCopy(fields()[4].schema(), other.myBool);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.myString)) {
this.myString = data().deepCopy(fields()[5].schema(), other.myString);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.myIntList)) {
this.myIntList = data().deepCopy(fields()[6].schema(), other.myIntList);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.myStringMap)) {
this.myStringMap = data().deepCopy(fields()[7].schema(), other.myStringMap);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.myBytes)) {
this.myBytes = data().deepCopy(fields()[8].schema(), other.myBytes);
fieldSetFlags()[8] = true;
}
if (isValidValue(fields()[9], other.myDummyAvro)) {
this.myDummyAvro = data().deepCopy(fields()[9].schema(), other.myDummyAvro);
fieldSetFlags()[9] = true;
}
this.myDummyAvroBuilder = null;
}
/**
* Gets the value of the 'myInt' field.
* @return The value.
*/
public int getMyInt() {
return myInt;
}
/**
* Sets the value of the 'myInt' field.
* @param value The value of 'myInt'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyInt(int value) {
validate(fields()[0], value);
this.myInt = value;
fieldSetFlags()[0] = true;
return this;
}
/**
* Checks whether the 'myInt' field has been set.
* @return True if the 'myInt' field has been set, false otherwise.
*/
public boolean hasMyInt() {
return fieldSetFlags()[0];
}
/**
* Clears the value of the 'myInt' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyInt() {
fieldSetFlags()[0] = false;
return this;
}
/**
* Gets the value of the 'myLong' field.
* @return The value.
*/
public long getMyLong() {
return myLong;
}
/**
* Sets the value of the 'myLong' field.
* @param value The value of 'myLong'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyLong(long value) {
validate(fields()[1], value);
this.myLong = value;
fieldSetFlags()[1] = true;
return this;
}
/**
* Checks whether the 'myLong' field has been set.
* @return True if the 'myLong' field has been set, false otherwise.
*/
public boolean hasMyLong() {
return fieldSetFlags()[1];
}
/**
* Clears the value of the 'myLong' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyLong() {
fieldSetFlags()[1] = false;
return this;
}
/**
* Gets the value of the 'myFloat' field.
* @return The value.
*/
public float getMyFloat() {
return myFloat;
}
/**
* Sets the value of the 'myFloat' field.
* @param value The value of 'myFloat'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyFloat(float value) {
validate(fields()[2], value);
this.myFloat = value;
fieldSetFlags()[2] = true;
return this;
}
/**
* Checks whether the 'myFloat' field has been set.
* @return True if the 'myFloat' field has been set, false otherwise.
*/
public boolean hasMyFloat() {
return fieldSetFlags()[2];
}
/**
* Clears the value of the 'myFloat' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyFloat() {
fieldSetFlags()[2] = false;
return this;
}
/**
* Gets the value of the 'myDouble' field.
* @return The value.
*/
public double getMyDouble() {
return myDouble;
}
/**
* Sets the value of the 'myDouble' field.
* @param value The value of 'myDouble'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyDouble(double value) {
validate(fields()[3], value);
this.myDouble = value;
fieldSetFlags()[3] = true;
return this;
}
/**
* Checks whether the 'myDouble' field has been set.
* @return True if the 'myDouble' field has been set, false otherwise.
*/
public boolean hasMyDouble() {
return fieldSetFlags()[3];
}
/**
* Clears the value of the 'myDouble' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyDouble() {
fieldSetFlags()[3] = false;
return this;
}
/**
* Gets the value of the 'myBool' field.
* @return The value.
*/
public boolean getMyBool() {
return myBool;
}
/**
* Sets the value of the 'myBool' field.
* @param value The value of 'myBool'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyBool(boolean value) {
validate(fields()[4], value);
this.myBool = value;
fieldSetFlags()[4] = true;
return this;
}
/**
* Checks whether the 'myBool' field has been set.
* @return True if the 'myBool' field has been set, false otherwise.
*/
public boolean hasMyBool() {
return fieldSetFlags()[4];
}
/**
* Clears the value of the 'myBool' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyBool() {
fieldSetFlags()[4] = false;
return this;
}
/**
* Gets the value of the 'myString' field.
* @return The value.
*/
public java.lang.String getMyString() {
return myString;
}
/**
* Sets the value of the 'myString' field.
* @param value The value of 'myString'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyString(java.lang.String value) {
validate(fields()[5], value);
this.myString = value;
fieldSetFlags()[5] = true;
return this;
}
/**
* Checks whether the 'myString' field has been set.
* @return True if the 'myString' field has been set, false otherwise.
*/
public boolean hasMyString() {
return fieldSetFlags()[5];
}
/**
* Clears the value of the 'myString' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyString() {
myString = null;
fieldSetFlags()[5] = false;
return this;
}
/**
* Gets the value of the 'myIntList' field.
* @return The value.
*/
public java.util.List getMyIntList() {
return myIntList;
}
/**
* Sets the value of the 'myIntList' field.
* @param value The value of 'myIntList'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyIntList(java.util.List value) {
validate(fields()[6], value);
this.myIntList = value;
fieldSetFlags()[6] = true;
return this;
}
/**
* Checks whether the 'myIntList' field has been set.
* @return True if the 'myIntList' field has been set, false otherwise.
*/
public boolean hasMyIntList() {
return fieldSetFlags()[6];
}
/**
* Clears the value of the 'myIntList' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyIntList() {
myIntList = null;
fieldSetFlags()[6] = false;
return this;
}
/**
* Gets the value of the 'myStringMap' field.
* @return The value.
*/
public java.util.Map getMyStringMap() {
return myStringMap;
}
/**
* Sets the value of the 'myStringMap' field.
* @param value The value of 'myStringMap'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyStringMap(java.util.Map value) {
validate(fields()[7], value);
this.myStringMap = value;
fieldSetFlags()[7] = true;
return this;
}
/**
* Checks whether the 'myStringMap' field has been set.
* @return True if the 'myStringMap' field has been set, false otherwise.
*/
public boolean hasMyStringMap() {
return fieldSetFlags()[7];
}
/**
* Clears the value of the 'myStringMap' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyStringMap() {
myStringMap = null;
fieldSetFlags()[7] = false;
return this;
}
/**
* Gets the value of the 'myBytes' field.
* @return The value.
*/
public java.nio.ByteBuffer getMyBytes() {
return myBytes;
}
/**
* Sets the value of the 'myBytes' field.
* @param value The value of 'myBytes'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyBytes(java.nio.ByteBuffer value) {
validate(fields()[8], value);
this.myBytes = value;
fieldSetFlags()[8] = true;
return this;
}
/**
* Checks whether the 'myBytes' field has been set.
* @return True if the 'myBytes' field has been set, false otherwise.
*/
public boolean hasMyBytes() {
return fieldSetFlags()[8];
}
/**
* Clears the value of the 'myBytes' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyBytes() {
myBytes = null;
fieldSetFlags()[8] = false;
return this;
}
/**
* Gets the value of the 'myDummyAvro' field.
* @return The value.
*/
public com.yahoo.bullet.dsl.DummyAvro getMyDummyAvro() {
return myDummyAvro;
}
/**
* Sets the value of the 'myDummyAvro' field.
* @param value The value of 'myDummyAvro'.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyDummyAvro(com.yahoo.bullet.dsl.DummyAvro value) {
validate(fields()[9], value);
this.myDummyAvroBuilder = null;
this.myDummyAvro = value;
fieldSetFlags()[9] = true;
return this;
}
/**
* Checks whether the 'myDummyAvro' field has been set.
* @return True if the 'myDummyAvro' field has been set, false otherwise.
*/
public boolean hasMyDummyAvro() {
return fieldSetFlags()[9];
}
/**
* Gets the Builder instance for the 'myDummyAvro' field and creates one if it doesn't exist yet.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder getMyDummyAvroBuilder() {
if (myDummyAvroBuilder == null) {
if (hasMyDummyAvro()) {
setMyDummyAvroBuilder(com.yahoo.bullet.dsl.DummyAvro.newBuilder(myDummyAvro));
} else {
setMyDummyAvroBuilder(com.yahoo.bullet.dsl.DummyAvro.newBuilder());
}
}
return myDummyAvroBuilder;
}
/**
* Sets the Builder instance for the 'myDummyAvro' field
* @param value The builder instance that must be set.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder setMyDummyAvroBuilder(com.yahoo.bullet.dsl.DummyAvro.Builder value) {
clearMyDummyAvro();
myDummyAvroBuilder = value;
return this;
}
/**
* Checks whether the 'myDummyAvro' field has an active Builder instance
* @return True if the 'myDummyAvro' field has an active Builder instance
*/
public boolean hasMyDummyAvroBuilder() {
return myDummyAvroBuilder != null;
}
/**
* Clears the value of the 'myDummyAvro' field.
* @return This builder.
*/
public com.yahoo.bullet.dsl.DummyAvro.Builder clearMyDummyAvro() {
myDummyAvro = null;
myDummyAvroBuilder = null;
fieldSetFlags()[9] = false;
return this;
}
@Override
@SuppressWarnings("unchecked")
public DummyAvro build() {
try {
DummyAvro record = new DummyAvro();
record.myInt = fieldSetFlags()[0] ? this.myInt : (java.lang.Integer) defaultValue(fields()[0]);
record.myLong = fieldSetFlags()[1] ? this.myLong : (java.lang.Long) defaultValue(fields()[1]);
record.myFloat = fieldSetFlags()[2] ? this.myFloat : (java.lang.Float) defaultValue(fields()[2]);
record.myDouble = fieldSetFlags()[3] ? this.myDouble : (java.lang.Double) defaultValue(fields()[3]);
record.myBool = fieldSetFlags()[4] ? this.myBool : (java.lang.Boolean) defaultValue(fields()[4]);
record.myString = fieldSetFlags()[5] ? this.myString : (java.lang.String) defaultValue(fields()[5]);
record.myIntList = fieldSetFlags()[6] ? this.myIntList : (java.util.List) defaultValue(fields()[6]);
record.myStringMap = fieldSetFlags()[7] ? this.myStringMap : (java.util.Map) defaultValue(fields()[7]);
record.myBytes = fieldSetFlags()[8] ? this.myBytes : (java.nio.ByteBuffer) defaultValue(fields()[8]);
if (myDummyAvroBuilder != null) {
try {
record.myDummyAvro = this.myDummyAvroBuilder.build();
} catch (org.apache.avro.AvroMissingFieldException e) {
e.addParentField(record.getSchema().getField("myDummyAvro"));
throw e;
}
} else {
record.myDummyAvro = fieldSetFlags()[9] ? this.myDummyAvro : (com.yahoo.bullet.dsl.DummyAvro) defaultValue(fields()[9]);
}
return record;
} catch (org.apache.avro.AvroMissingFieldException e) {
throw e;
} catch (java.lang.Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
@SuppressWarnings("unchecked")
private static final org.apache.avro.io.DatumWriter
WRITER$ = (org.apache.avro.io.DatumWriter)MODEL$.createDatumWriter(SCHEMA$);
@Override public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")
private static final org.apache.avro.io.DatumReader
READER$ = (org.apache.avro.io.DatumReader)MODEL$.createDatumReader(SCHEMA$);
@Override public void readExternal(java.io.ObjectInput in)
throws java.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
@Override protected boolean hasCustomCoders() { return true; }
@Override public void customEncode(org.apache.avro.io.Encoder out)
throws java.io.IOException
{
out.writeInt(this.myInt);
out.writeLong(this.myLong);
out.writeFloat(this.myFloat);
out.writeDouble(this.myDouble);
out.writeBoolean(this.myBool);
out.writeString(this.myString);
if (this.myIntList == null) {
out.writeIndex(1);
out.writeNull();
} else {
out.writeIndex(0);
long size0 = this.myIntList.size();
out.writeArrayStart();
out.setItemCount(size0);
long actualSize0 = 0;
for (java.lang.Integer e0: this.myIntList) {
actualSize0++;
out.startItem();
out.writeInt(e0);
}
out.writeArrayEnd();
if (actualSize0 != size0)
throw new java.util.ConcurrentModificationException("Array-size written was " + size0 + ", but element count was " + actualSize0 + ".");
}
if (this.myStringMap == null) {
out.writeIndex(1);
out.writeNull();
} else {
out.writeIndex(0);
long size1 = this.myStringMap.size();
out.writeMapStart();
out.setItemCount(size1);
long actualSize1 = 0;
for (java.util.Map.Entry e1: this.myStringMap.entrySet()) {
actualSize1++;
out.startItem();
out.writeString(e1.getKey());
java.lang.String v1 = e1.getValue();
out.writeString(v1);
}
out.writeMapEnd();
if (actualSize1 != size1)
throw new java.util.ConcurrentModificationException("Map-size written was " + size1 + ", but element count was " + actualSize1 + ".");
}
if (this.myBytes == null) {
out.writeIndex(1);
out.writeNull();
} else {
out.writeIndex(0);
out.writeBytes(this.myBytes);
}
if (this.myDummyAvro == null) {
out.writeIndex(1);
out.writeNull();
} else {
out.writeIndex(0);
this.myDummyAvro.customEncode(out);
}
}
@Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
throws java.io.IOException
{
org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
if (fieldOrder == null) {
this.myInt = in.readInt();
this.myLong = in.readLong();
this.myFloat = in.readFloat();
this.myDouble = in.readDouble();
this.myBool = in.readBoolean();
this.myString = in.readString();
if (in.readIndex() != 0) {
in.readNull();
this.myIntList = null;
} else {
long size0 = in.readArrayStart();
java.util.List a0 = this.myIntList;
if (a0 == null) {
a0 = new SpecificData.Array((int)size0, SCHEMA$.getField("myIntList").schema().getTypes().get(0));
this.myIntList = a0;
} else a0.clear();
SpecificData.Array ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array)a0 : null);
for ( ; 0 < size0; size0 = in.arrayNext()) {
for ( ; size0 != 0; size0--) {
java.lang.Integer e0 = (ga0 != null ? ga0.peek() : null);
e0 = in.readInt();
a0.add(e0);
}
}
}
if (in.readIndex() != 0) {
in.readNull();
this.myStringMap = null;
} else {
long size1 = in.readMapStart();
java.util.Map m1 = this.myStringMap; // Need fresh name due to limitation of macro system
if (m1 == null) {
m1 = new java.util.HashMap((int)size1);
this.myStringMap = m1;
} else m1.clear();
for ( ; 0 < size1; size1 = in.mapNext()) {
for ( ; size1 != 0; size1--) {
java.lang.String k1 = null;
k1 = in.readString();
java.lang.String v1 = null;
v1 = in.readString();
m1.put(k1, v1);
}
}
}
if (in.readIndex() != 0) {
in.readNull();
this.myBytes = null;
} else {
this.myBytes = in.readBytes(this.myBytes);
}
if (in.readIndex() != 0) {
in.readNull();
this.myDummyAvro = null;
} else {
if (this.myDummyAvro == null) {
this.myDummyAvro = new com.yahoo.bullet.dsl.DummyAvro();
}
this.myDummyAvro.customDecode(in);
}
} else {
for (int i = 0; i < 10; i++) {
switch (fieldOrder[i].pos()) {
case 0:
this.myInt = in.readInt();
break;
case 1:
this.myLong = in.readLong();
break;
case 2:
this.myFloat = in.readFloat();
break;
case 3:
this.myDouble = in.readDouble();
break;
case 4:
this.myBool = in.readBoolean();
break;
case 5:
this.myString = in.readString();
break;
case 6:
if (in.readIndex() != 0) {
in.readNull();
this.myIntList = null;
} else {
long size0 = in.readArrayStart();
java.util.List a0 = this.myIntList;
if (a0 == null) {
a0 = new SpecificData.Array((int)size0, SCHEMA$.getField("myIntList").schema().getTypes().get(0));
this.myIntList = a0;
} else a0.clear();
SpecificData.Array ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array)a0 : null);
for ( ; 0 < size0; size0 = in.arrayNext()) {
for ( ; size0 != 0; size0--) {
java.lang.Integer e0 = (ga0 != null ? ga0.peek() : null);
e0 = in.readInt();
a0.add(e0);
}
}
}
break;
case 7:
if (in.readIndex() != 0) {
in.readNull();
this.myStringMap = null;
} else {
long size1 = in.readMapStart();
java.util.Map m1 = this.myStringMap; // Need fresh name due to limitation of macro system
if (m1 == null) {
m1 = new java.util.HashMap((int)size1);
this.myStringMap = m1;
} else m1.clear();
for ( ; 0 < size1; size1 = in.mapNext()) {
for ( ; size1 != 0; size1--) {
java.lang.String k1 = null;
k1 = in.readString();
java.lang.String v1 = null;
v1 = in.readString();
m1.put(k1, v1);
}
}
}
break;
case 8:
if (in.readIndex() != 0) {
in.readNull();
this.myBytes = null;
} else {
this.myBytes = in.readBytes(this.myBytes);
}
break;
case 9:
if (in.readIndex() != 0) {
in.readNull();
this.myDummyAvro = null;
} else {
if (this.myDummyAvro == null) {
this.myDummyAvro = new com.yahoo.bullet.dsl.DummyAvro();
}
this.myDummyAvro.customDecode(in);
}
break;
default:
throw new java.io.IOException("Corrupt ResolvingDecoder.");
}
}
}
}
}