me.tfeng.play.mongodb.OplogItem Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package me.tfeng.play.mongodb;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class OplogItem 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\":\"OplogItem\",\"namespace\":\"me.tfeng.play.mongodb\",\"fields\":[{\"name\":\"timestamp\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"mongo-name\":\"ts\"},{\"name\":\"changeId\",\"type\":\"long\",\"mongo-name\":\"h\"},{\"name\":\"version\",\"type\":\"int\",\"mongo-name\":\"v\"},{\"name\":\"operation\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"mongo-name\":\"op\"},{\"name\":\"namespace\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"mongo-name\":\"ns\"},{\"name\":\"document\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\",\"mongo-type\":\"ANY\"},\"mongo-name\":\"o\"}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
@Deprecated public java.lang.String timestamp;
@Deprecated public long changeId;
@Deprecated public int version;
@Deprecated public java.lang.String operation;
@Deprecated public java.lang.String namespace;
@Deprecated public java.lang.String document;
/**
* 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 OplogItem() {}
/**
* All-args constructor.
*/
public OplogItem(java.lang.String timestamp, java.lang.Long changeId, java.lang.Integer version, java.lang.String operation, java.lang.String namespace, java.lang.String document) {
this.timestamp = timestamp;
this.changeId = changeId;
this.version = version;
this.operation = operation;
this.namespace = namespace;
this.document = document;
}
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 timestamp;
case 1: return changeId;
case 2: return version;
case 3: return operation;
case 4: return namespace;
case 5: return document;
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: timestamp = (java.lang.String)value$; break;
case 1: changeId = (java.lang.Long)value$; break;
case 2: version = (java.lang.Integer)value$; break;
case 3: operation = (java.lang.String)value$; break;
case 4: namespace = (java.lang.String)value$; break;
case 5: document = (java.lang.String)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'timestamp' field.
*/
public java.lang.String getTimestamp() {
return timestamp;
}
/**
* Sets the value of the 'timestamp' field.
* @param value the value to set.
*/
public void setTimestamp(java.lang.String value) {
this.timestamp = value;
}
/**
* Gets the value of the 'changeId' field.
*/
public java.lang.Long getChangeId() {
return changeId;
}
/**
* Sets the value of the 'changeId' field.
* @param value the value to set.
*/
public void setChangeId(java.lang.Long value) {
this.changeId = value;
}
/**
* Gets the value of the 'version' field.
*/
public java.lang.Integer getVersion() {
return version;
}
/**
* Sets the value of the 'version' field.
* @param value the value to set.
*/
public void setVersion(java.lang.Integer value) {
this.version = value;
}
/**
* Gets the value of the 'operation' field.
*/
public java.lang.String getOperation() {
return operation;
}
/**
* Sets the value of the 'operation' field.
* @param value the value to set.
*/
public void setOperation(java.lang.String value) {
this.operation = value;
}
/**
* Gets the value of the 'namespace' field.
*/
public java.lang.String getNamespace() {
return namespace;
}
/**
* Sets the value of the 'namespace' field.
* @param value the value to set.
*/
public void setNamespace(java.lang.String value) {
this.namespace = value;
}
/**
* Gets the value of the 'document' field.
*/
public java.lang.String getDocument() {
return document;
}
/**
* Sets the value of the 'document' field.
* @param value the value to set.
*/
public void setDocument(java.lang.String value) {
this.document = value;
}
/** Creates a new OplogItem RecordBuilder */
public static me.tfeng.play.mongodb.OplogItem.Builder newBuilder() {
return new me.tfeng.play.mongodb.OplogItem.Builder();
}
/** Creates a new OplogItem RecordBuilder by copying an existing Builder */
public static me.tfeng.play.mongodb.OplogItem.Builder newBuilder(me.tfeng.play.mongodb.OplogItem.Builder other) {
return new me.tfeng.play.mongodb.OplogItem.Builder(other);
}
/** Creates a new OplogItem RecordBuilder by copying an existing OplogItem instance */
public static me.tfeng.play.mongodb.OplogItem.Builder newBuilder(me.tfeng.play.mongodb.OplogItem other) {
return new me.tfeng.play.mongodb.OplogItem.Builder(other);
}
/**
* RecordBuilder for OplogItem instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
private java.lang.String timestamp;
private long changeId;
private int version;
private java.lang.String operation;
private java.lang.String namespace;
private java.lang.String document;
/** Creates a new Builder */
private Builder() {
super(me.tfeng.play.mongodb.OplogItem.SCHEMA$);
}
/** Creates a Builder by copying an existing Builder */
private Builder(me.tfeng.play.mongodb.OplogItem.Builder other) {
super(other);
if (isValidValue(fields()[0], other.timestamp)) {
this.timestamp = data().deepCopy(fields()[0].schema(), other.timestamp);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.changeId)) {
this.changeId = data().deepCopy(fields()[1].schema(), other.changeId);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.version)) {
this.version = data().deepCopy(fields()[2].schema(), other.version);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.operation)) {
this.operation = data().deepCopy(fields()[3].schema(), other.operation);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.namespace)) {
this.namespace = data().deepCopy(fields()[4].schema(), other.namespace);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.document)) {
this.document = data().deepCopy(fields()[5].schema(), other.document);
fieldSetFlags()[5] = true;
}
}
/** Creates a Builder by copying an existing OplogItem instance */
private Builder(me.tfeng.play.mongodb.OplogItem other) {
super(me.tfeng.play.mongodb.OplogItem.SCHEMA$);
if (isValidValue(fields()[0], other.timestamp)) {
this.timestamp = data().deepCopy(fields()[0].schema(), other.timestamp);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.changeId)) {
this.changeId = data().deepCopy(fields()[1].schema(), other.changeId);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.version)) {
this.version = data().deepCopy(fields()[2].schema(), other.version);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.operation)) {
this.operation = data().deepCopy(fields()[3].schema(), other.operation);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.namespace)) {
this.namespace = data().deepCopy(fields()[4].schema(), other.namespace);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.document)) {
this.document = data().deepCopy(fields()[5].schema(), other.document);
fieldSetFlags()[5] = true;
}
}
/** Gets the value of the 'timestamp' field */
public java.lang.String getTimestamp() {
return timestamp;
}
/** Sets the value of the 'timestamp' field */
public me.tfeng.play.mongodb.OplogItem.Builder setTimestamp(java.lang.String value) {
validate(fields()[0], value);
this.timestamp = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'timestamp' field has been set */
public boolean hasTimestamp() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'timestamp' field */
public me.tfeng.play.mongodb.OplogItem.Builder clearTimestamp() {
timestamp = null;
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'changeId' field */
public java.lang.Long getChangeId() {
return changeId;
}
/** Sets the value of the 'changeId' field */
public me.tfeng.play.mongodb.OplogItem.Builder setChangeId(long value) {
validate(fields()[1], value);
this.changeId = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'changeId' field has been set */
public boolean hasChangeId() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'changeId' field */
public me.tfeng.play.mongodb.OplogItem.Builder clearChangeId() {
fieldSetFlags()[1] = false;
return this;
}
/** Gets the value of the 'version' field */
public java.lang.Integer getVersion() {
return version;
}
/** Sets the value of the 'version' field */
public me.tfeng.play.mongodb.OplogItem.Builder setVersion(int value) {
validate(fields()[2], value);
this.version = value;
fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'version' field has been set */
public boolean hasVersion() {
return fieldSetFlags()[2];
}
/** Clears the value of the 'version' field */
public me.tfeng.play.mongodb.OplogItem.Builder clearVersion() {
fieldSetFlags()[2] = false;
return this;
}
/** Gets the value of the 'operation' field */
public java.lang.String getOperation() {
return operation;
}
/** Sets the value of the 'operation' field */
public me.tfeng.play.mongodb.OplogItem.Builder setOperation(java.lang.String value) {
validate(fields()[3], value);
this.operation = value;
fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'operation' field has been set */
public boolean hasOperation() {
return fieldSetFlags()[3];
}
/** Clears the value of the 'operation' field */
public me.tfeng.play.mongodb.OplogItem.Builder clearOperation() {
operation = null;
fieldSetFlags()[3] = false;
return this;
}
/** Gets the value of the 'namespace' field */
public java.lang.String getNamespace() {
return namespace;
}
/** Sets the value of the 'namespace' field */
public me.tfeng.play.mongodb.OplogItem.Builder setNamespace(java.lang.String value) {
validate(fields()[4], value);
this.namespace = value;
fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'namespace' field has been set */
public boolean hasNamespace() {
return fieldSetFlags()[4];
}
/** Clears the value of the 'namespace' field */
public me.tfeng.play.mongodb.OplogItem.Builder clearNamespace() {
namespace = null;
fieldSetFlags()[4] = false;
return this;
}
/** Gets the value of the 'document' field */
public java.lang.String getDocument() {
return document;
}
/** Sets the value of the 'document' field */
public me.tfeng.play.mongodb.OplogItem.Builder setDocument(java.lang.String value) {
validate(fields()[5], value);
this.document = value;
fieldSetFlags()[5] = true;
return this;
}
/** Checks whether the 'document' field has been set */
public boolean hasDocument() {
return fieldSetFlags()[5];
}
/** Clears the value of the 'document' field */
public me.tfeng.play.mongodb.OplogItem.Builder clearDocument() {
document = null;
fieldSetFlags()[5] = false;
return this;
}
@Override
public OplogItem build() {
try {
OplogItem record = new OplogItem();
record.timestamp = fieldSetFlags()[0] ? this.timestamp : (java.lang.String) defaultValue(fields()[0]);
record.changeId = fieldSetFlags()[1] ? this.changeId : (java.lang.Long) defaultValue(fields()[1]);
record.version = fieldSetFlags()[2] ? this.version : (java.lang.Integer) defaultValue(fields()[2]);
record.operation = fieldSetFlags()[3] ? this.operation : (java.lang.String) defaultValue(fields()[3]);
record.namespace = fieldSetFlags()[4] ? this.namespace : (java.lang.String) defaultValue(fields()[4]);
record.document = fieldSetFlags()[5] ? this.document : (java.lang.String) defaultValue(fields()[5]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}