at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kafka-connect-mongodb Show documentation
Show all versions of kafka-connect-mongodb Show documentation
A Kafka connect MongoDB sink connector.
The newest version!
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package at.grahsl.kafka.connect.mongodb.data.avro;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.SchemaStore;
import org.apache.avro.specific.SpecificData;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class TweetMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
private static final long serialVersionUID = -614364705592652792L;
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TweetMsg\",\"namespace\":\"at.grahsl.kafka.connect.mongodb.data.avro\",\"fields\":[{\"name\":\"_id\",\"type\":\"long\"},{\"name\":\"text\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"hashtags\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}}]}");
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 BinaryMessageDecoder instance 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
*/
public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
}
/** Serializes this TweetMsg to a ByteBuffer. */
public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
return ENCODER.encode(this);
}
/** Deserializes a TweetMsg from a ByteBuffer. */
public static TweetMsg fromByteBuffer(
java.nio.ByteBuffer b) throws java.io.IOException {
return DECODER.decode(b);
}
private long _id;
private java.lang.String text;
private java.util.List hashtags;
/**
* 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 TweetMsg() {}
/**
* All-args constructor.
* @param _id The new value for _id
* @param text The new value for text
* @param hashtags The new value for hashtags
*/
public TweetMsg(java.lang.Long _id, java.lang.String text, java.util.List hashtags) {
this._id = _id;
this.text = text;
this.hashtags = hashtags;
}
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 text;
case 2: return hashtags;
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.Long)value$; break;
case 1: text = (java.lang.String)value$; break;
case 2: hashtags = (java.util.List)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the '_id' field.
* @return The value of the '_id' field.
*/
public java.lang.Long getId$1() {
return _id;
}
/**
* Sets the value of the '_id' field.
* @param value the value to set.
*/
public void setId$1(java.lang.Long value) {
this._id = value;
}
/**
* Gets the value of the 'text' field.
* @return The value of the 'text' field.
*/
public java.lang.String getText() {
return text;
}
/**
* Sets the value of the 'text' field.
* @param value the value to set.
*/
public void setText(java.lang.String value) {
this.text = value;
}
/**
* Gets the value of the 'hashtags' field.
* @return The value of the 'hashtags' field.
*/
public java.util.List getHashtags() {
return hashtags;
}
/**
* Sets the value of the 'hashtags' field.
* @param value the value to set.
*/
public void setHashtags(java.util.List value) {
this.hashtags = value;
}
/**
* Creates a new TweetMsg RecordBuilder.
* @return A new TweetMsg RecordBuilder
*/
public static at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder newBuilder() {
return new at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder();
}
/**
* Creates a new TweetMsg RecordBuilder by copying an existing Builder.
* @param other The existing builder to copy.
* @return A new TweetMsg RecordBuilder
*/
public static at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder newBuilder(at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder other) {
return new at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder(other);
}
/**
* Creates a new TweetMsg RecordBuilder by copying an existing TweetMsg instance.
* @param other The existing instance to copy.
* @return A new TweetMsg RecordBuilder
*/
public static at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder newBuilder(at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg other) {
return new at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder(other);
}
/**
* RecordBuilder for TweetMsg instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
private long _id;
private java.lang.String text;
private java.util.List hashtags;
/** 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(at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.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.text)) {
this.text = data().deepCopy(fields()[1].schema(), other.text);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.hashtags)) {
this.hashtags = data().deepCopy(fields()[2].schema(), other.hashtags);
fieldSetFlags()[2] = true;
}
}
/**
* Creates a Builder by copying an existing TweetMsg instance
* @param other The existing instance to copy.
*/
private Builder(at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg other) {
super(SCHEMA$);
if (isValidValue(fields()[0], other._id)) {
this._id = data().deepCopy(fields()[0].schema(), other._id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.text)) {
this.text = data().deepCopy(fields()[1].schema(), other.text);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.hashtags)) {
this.hashtags = data().deepCopy(fields()[2].schema(), other.hashtags);
fieldSetFlags()[2] = true;
}
}
/**
* Gets the value of the '_id' field.
* @return The value.
*/
public java.lang.Long getId$1() {
return _id;
}
/**
* Sets the value of the '_id' field.
* @param value The value of '_id'.
* @return This builder.
*/
public at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder setId$1(long value) {
validate(fields()[0], value);
this._id = value;
fieldSetFlags()[0] = true;
return this;
}
/**
* Checks whether the '_id' field has been set.
* @return True if the '_id' field has been set, false otherwise.
*/
public boolean hasId$1() {
return fieldSetFlags()[0];
}
/**
* Clears the value of the '_id' field.
* @return This builder.
*/
public at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder clearId$1() {
fieldSetFlags()[0] = false;
return this;
}
/**
* Gets the value of the 'text' field.
* @return The value.
*/
public java.lang.String getText() {
return text;
}
/**
* Sets the value of the 'text' field.
* @param value The value of 'text'.
* @return This builder.
*/
public at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder setText(java.lang.String value) {
validate(fields()[1], value);
this.text = value;
fieldSetFlags()[1] = true;
return this;
}
/**
* Checks whether the 'text' field has been set.
* @return True if the 'text' field has been set, false otherwise.
*/
public boolean hasText() {
return fieldSetFlags()[1];
}
/**
* Clears the value of the 'text' field.
* @return This builder.
*/
public at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder clearText() {
text = null;
fieldSetFlags()[1] = false;
return this;
}
/**
* Gets the value of the 'hashtags' field.
* @return The value.
*/
public java.util.List getHashtags() {
return hashtags;
}
/**
* Sets the value of the 'hashtags' field.
* @param value The value of 'hashtags'.
* @return This builder.
*/
public at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder setHashtags(java.util.List value) {
validate(fields()[2], value);
this.hashtags = value;
fieldSetFlags()[2] = true;
return this;
}
/**
* Checks whether the 'hashtags' field has been set.
* @return True if the 'hashtags' field has been set, false otherwise.
*/
public boolean hasHashtags() {
return fieldSetFlags()[2];
}
/**
* Clears the value of the 'hashtags' field.
* @return This builder.
*/
public at.grahsl.kafka.connect.mongodb.data.avro.TweetMsg.Builder clearHashtags() {
hashtags = null;
fieldSetFlags()[2] = false;
return this;
}
@Override
@SuppressWarnings("unchecked")
public TweetMsg build() {
try {
TweetMsg record = new TweetMsg();
record._id = fieldSetFlags()[0] ? this._id : (java.lang.Long) defaultValue(fields()[0]);
record.text = fieldSetFlags()[1] ? this.text : (java.lang.String) defaultValue(fields()[1]);
record.hashtags = fieldSetFlags()[2] ? this.hashtags : (java.util.List) defaultValue(fields()[2]);
return record;
} 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));
}
}