package com.cloudera.flume.handlers.thrift;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.thrift.*;
import org.apache.thrift.async.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.protocol.*;
public class RawEvent implements TBase<RawEvent, RawEvent._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("RawEvent");
private static final TField RAW_FIELD_DESC = new TField("raw", TType.STRING, (short)1);
public ByteBuffer raw;
public enum _Fields implements TFieldIdEnum {
RAW((short)1, "raw");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
switch(fieldId) {
case 1:
return RAW;
default:
return null;
}
}
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(
short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
return _thriftId;
}
return _fieldName;
}
}
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.RAW, new FieldMetaData("raw", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(RawEvent.class, metaDataMap);
}
}
ByteBuffer raw)
{
this();
this.raw = raw;
}
if (other.isSetRaw()) {
this.raw = ByteBuffer.wrap(new byte[other.raw.limit() - other.raw.arrayOffset()]);
System.arraycopy(other.raw.array(), other.raw.arrayOffset(), raw.array(), 0, other.raw.limit() - other.raw.arrayOffset());
}
}
return new RawEvent(this);
}
@Deprecated
public RawEvent
clone() {
return new RawEvent(this);
}
@Override
this.raw = null;
}
return this.raw;
}
public RawEvent
setRaw(ByteBuffer raw) {
this.raw = raw;
return this;
}
this.raw = null;
}
return this.raw != null;
}
if (!value) {
this.raw = null;
}
}
switch (field) {
case RAW:
if (value == null) {
unsetRaw();
} else {
setRaw((ByteBuffer)value);
}
break;
}
}
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
}
switch (field) {
case RAW:
return getRaw();
}
throw new IllegalStateException();
}
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
}
public boolean isSet(_Fields field) {
switch (field) {
case RAW:
return isSetRaw();
}
throw new IllegalStateException();
}
public boolean isSet(
int fieldID) {
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof RawEvent)
return this.equals((RawEvent)that);
return false;
}
public boolean equals(RawEvent that) {
if (that == null)
return false;
boolean this_present_raw = true && this.isSetRaw();
boolean that_present_raw = true && that.isSetRaw();
if (this_present_raw || that_present_raw) {
if (!(this_present_raw && that_present_raw))
return false;
if (!this.raw.equals(that.raw))
return false;
}
return true;
}
@Override
return 0;
}
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
RawEvent typedOther = (RawEvent)other;
lastComparison = Boolean.valueOf(isSetRaw()).compareTo(typedOther.isSetRaw());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRaw()) { lastComparison = TBaseHelper.compareTo(this.raw, typedOther.raw);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public void read(TProtocol iprot)
throws TException {
TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == TType.STOP) {
break;
}
switch (field.id) {
case 1:
if (field.type == TType.STRING) {
this.raw = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
validate();
}
public void write(TProtocol oprot)
throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.raw != null) {
oprot.writeFieldBegin(RAW_FIELD_DESC);
oprot.writeBinary(this.raw);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
StringBuilder sb = new StringBuilder("RawEvent(");
boolean first = true;
sb.append("raw:");
if (this.raw == null) {
sb.append("null");
} else {
TBaseHelper.toString(this.raw, sb);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate()
throws TException {
}
}