org.apache.flume.source.avro.AvroFlumeEvent Maven / Gradle / Ivy
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package org.apache.flume.source.avro;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class AvroFlumeEvent 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\":\"AvroFlumeEvent\",\"namespace\":\"org.apache.flume.source.avro\",\"fields\":[{\"name\":\"headers\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"body\",\"type\":\"bytes\"}]}");
@Deprecated public java.util.Map headers;
@Deprecated public java.nio.ByteBuffer body;
/**
* Default constructor.
*/
public AvroFlumeEvent() {}
/**
* All-args constructor.
*/
public AvroFlumeEvent(java.util.Map headers, java.nio.ByteBuffer body) {
this.headers = headers;
this.body = body;
}
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 headers;
case 1: return body;
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: headers = (java.util.Map)value$; break;
case 1: body = (java.nio.ByteBuffer)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'headers' field.
*/
public java.util.Map getHeaders() {
return headers;
}
/**
* Sets the value of the 'headers' field.
* @param value the value to set.
*/
public void setHeaders(java.util.Map value) {
this.headers = value;
}
/**
* Gets the value of the 'body' field.
*/
public java.nio.ByteBuffer getBody() {
return body;
}
/**
* Sets the value of the 'body' field.
* @param value the value to set.
*/
public void setBody(java.nio.ByteBuffer value) {
this.body = value;
}
/** Creates a new AvroFlumeEvent RecordBuilder */
public static org.apache.flume.source.avro.AvroFlumeEvent.Builder newBuilder() {
return new org.apache.flume.source.avro.AvroFlumeEvent.Builder();
}
/** Creates a new AvroFlumeEvent RecordBuilder by copying an existing Builder */
public static org.apache.flume.source.avro.AvroFlumeEvent.Builder newBuilder(org.apache.flume.source.avro.AvroFlumeEvent.Builder other) {
return new org.apache.flume.source.avro.AvroFlumeEvent.Builder(other);
}
/** Creates a new AvroFlumeEvent RecordBuilder by copying an existing AvroFlumeEvent instance */
public static org.apache.flume.source.avro.AvroFlumeEvent.Builder newBuilder(org.apache.flume.source.avro.AvroFlumeEvent other) {
return new org.apache.flume.source.avro.AvroFlumeEvent.Builder(other);
}
/**
* RecordBuilder for AvroFlumeEvent instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
private java.util.Map headers;
private java.nio.ByteBuffer body;
/** Creates a new Builder */
private Builder() {
super(org.apache.flume.source.avro.AvroFlumeEvent.SCHEMA$);
}
/** Creates a Builder by copying an existing Builder */
private Builder(org.apache.flume.source.avro.AvroFlumeEvent.Builder other) {
super(other);
}
/** Creates a Builder by copying an existing AvroFlumeEvent instance */
private Builder(org.apache.flume.source.avro.AvroFlumeEvent other) {
super(org.apache.flume.source.avro.AvroFlumeEvent.SCHEMA$);
if (isValidValue(fields()[0], other.headers)) {
this.headers = data().deepCopy(fields()[0].schema(), other.headers);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.body)) {
this.body = data().deepCopy(fields()[1].schema(), other.body);
fieldSetFlags()[1] = true;
}
}
/** Gets the value of the 'headers' field */
public java.util.Map getHeaders() {
return headers;
}
/** Sets the value of the 'headers' field */
public org.apache.flume.source.avro.AvroFlumeEvent.Builder setHeaders(java.util.Map value) {
validate(fields()[0], value);
this.headers = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'headers' field has been set */
public boolean hasHeaders() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'headers' field */
public org.apache.flume.source.avro.AvroFlumeEvent.Builder clearHeaders() {
headers = null;
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'body' field */
public java.nio.ByteBuffer getBody() {
return body;
}
/** Sets the value of the 'body' field */
public org.apache.flume.source.avro.AvroFlumeEvent.Builder setBody(java.nio.ByteBuffer value) {
validate(fields()[1], value);
this.body = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'body' field has been set */
public boolean hasBody() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'body' field */
public org.apache.flume.source.avro.AvroFlumeEvent.Builder clearBody() {
body = null;
fieldSetFlags()[1] = false;
return this;
}
@Override
public AvroFlumeEvent build() {
try {
AvroFlumeEvent record = new AvroFlumeEvent();
record.headers = fieldSetFlags()[0] ? this.headers : (java.util.Map) defaultValue(fields()[0]);
record.body = fieldSetFlags()[1] ? this.body : (java.nio.ByteBuffer) defaultValue(fields()[1]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy