package com.cloudera.flume.conf.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 CommandStatusThrift implements TBase<CommandStatusThrift, CommandStatusThrift._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("CommandStatusThrift");
private static final TField CMD_ID_FIELD_DESC = new TField("cmdId", TType.I64, (short)1);
private static final TField STATE_FIELD_DESC = new TField("state", TType.STRING, (short)2);
private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)3);
private static final TField CMD_FIELD_DESC = new TField("cmd", TType.STRUCT, (short)4);
public long cmdId;
public String state;
public String message;
public FlumeMasterCommandThrift cmd;
public enum _Fields implements TFieldIdEnum {
CMD_ID((short)1, "cmdId"),
STATE((short)2, "state"),
MESSAGE((short)3, "message"),
CMD((short)4, "cmd");
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 CMD_ID;
case 2:
return STATE;
case 3:
return MESSAGE;
case 4:
return CMD;
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;
}
}
private static final int __CMDID_ISSET_ID = 0;
private BitSet __isset_bit_vector = new BitSet(1);
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.CMD_ID, new FieldMetaData("cmdId", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
tmpMap.put(_Fields.STATE, new FieldMetaData("state", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.CMD, new FieldMetaData("cmd", TFieldRequirementType.DEFAULT,
new StructMetaData(TType.STRUCT, FlumeMasterCommandThrift.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(CommandStatusThrift.class, metaDataMap);
}
}
long cmdId,
String state,
String message,
FlumeMasterCommandThrift cmd)
{
this();
this.cmdId = cmdId;
setCmdIdIsSet(true);
this.state = state;
this.message = message;
this.cmd = cmd;
}
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
this.cmdId = other.cmdId;
if (other.isSetState()) {
this.state = other.state;
}
if (other.isSetMessage()) {
this.message = other.message;
}
if (other.isSetCmd()) {
this.cmd = new FlumeMasterCommandThrift(other.cmd);
}
}
return new CommandStatusThrift(this);
}
@Deprecated
public CommandStatusThrift
clone() {
return new CommandStatusThrift(this);
}
@Override
setCmdIdIsSet(false);
this.cmdId = 0;
this.state = null;
this.message = null;
this.cmd = null;
}
return this.cmdId;
}
public CommandStatusThrift
setCmdId(
long cmdId) {
this.cmdId = cmdId;
setCmdIdIsSet(true);
return this;
}
__isset_bit_vector.clear(__CMDID_ISSET_ID);
}
return __isset_bit_vector.get(__CMDID_ISSET_ID);
}
__isset_bit_vector.set(__CMDID_ISSET_ID, value);
}
return this.state;
}
public CommandStatusThrift
setState(String state) {
this.state = state;
return this;
}
this.state = null;
}
return this.state != null;
}
if (!value) {
this.state = null;
}
}
return this.message;
}
public CommandStatusThrift
setMessage(String message) {
this.message = message;
return this;
}
this.message = null;
}
return this.message != null;
}
if (!value) {
this.message = null;
}
}
public FlumeMasterCommandThrift
getCmd() {
return this.cmd;
}
public CommandStatusThrift
setCmd(FlumeMasterCommandThrift cmd) {
this.cmd = cmd;
return this;
}
this.cmd = null;
}
return this.cmd != null;
}
if (!value) {
this.cmd = null;
}
}
switch (field) {
case CMD_ID:
if (value == null) {
unsetCmdId();
} else {
setCmdId((Long)value);
}
break;
case STATE:
if (value == null) {
unsetState();
} else {
setState((String)value);
}
break;
case MESSAGE:
if (value == null) {
unsetMessage();
} else {
setMessage((String)value);
}
break;
case CMD:
if (value == null) {
unsetCmd();
} else {
setCmd((FlumeMasterCommandThrift)value);
}
break;
}
}
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
}
switch (field) {
case CMD_ID:
return new Long(getCmdId());
case STATE:
return getState();
case MESSAGE:
return getMessage();
case CMD:
return getCmd();
}
throw new IllegalStateException();
}
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
}
public boolean isSet(_Fields field) {
switch (field) {
case CMD_ID:
return isSetCmdId();
case STATE:
return isSetState();
case MESSAGE:
return isSetMessage();
case CMD:
return isSetCmd();
}
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 CommandStatusThrift)
return this.equals((CommandStatusThrift)that);
return false;
}
public boolean equals(CommandStatusThrift that) {
if (that == null)
return false;
boolean this_present_cmdId = true;
boolean that_present_cmdId = true;
if (this_present_cmdId || that_present_cmdId) {
if (!(this_present_cmdId && that_present_cmdId))
return false;
if (this.cmdId != that.cmdId)
return false;
}
boolean this_present_state = true && this.isSetState();
boolean that_present_state = true && that.isSetState();
if (this_present_state || that_present_state) {
if (!(this_present_state && that_present_state))
return false;
if (!this.state.equals(that.state))
return false;
}
boolean this_present_message = true && this.isSetMessage();
boolean that_present_message = true && that.isSetMessage();
if (this_present_message || that_present_message) {
if (!(this_present_message && that_present_message))
return false;
if (!this.message.equals(that.message))
return false;
}
boolean this_present_cmd = true && this.isSetCmd();
boolean that_present_cmd = true && that.isSetCmd();
if (this_present_cmd || that_present_cmd) {
if (!(this_present_cmd && that_present_cmd))
return false;
if (!this.cmd.equals(that.cmd))
return false;
}
return true;
}
@Override
return 0;
}
public int compareTo(CommandStatusThrift other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
CommandStatusThrift typedOther = (CommandStatusThrift)other;
lastComparison = Boolean.valueOf(isSetCmdId()).compareTo(typedOther.isSetCmdId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCmdId()) { lastComparison = TBaseHelper.compareTo(this.cmdId, typedOther.cmdId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetState()).compareTo(typedOther.isSetState());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetState()) { lastComparison = TBaseHelper.compareTo(this.state, typedOther.state);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMessage()) { lastComparison = TBaseHelper.compareTo(this.message, typedOther.message);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCmd()).compareTo(typedOther.isSetCmd());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCmd()) { lastComparison = TBaseHelper.compareTo(this.cmd, typedOther.cmd);
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.I64) {
this.cmdId = iprot.readI64();
setCmdIdIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2:
if (field.type == TType.STRING) {
this.state = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3:
if (field.type == TType.STRING) {
this.message = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 4:
if (field.type == TType.STRUCT) {
this.cmd = new FlumeMasterCommandThrift();
this.cmd.read(iprot);
} 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);
oprot.writeFieldBegin(CMD_ID_FIELD_DESC);
oprot.writeI64(this.cmdId);
oprot.writeFieldEnd();
if (this.state != null) {
oprot.writeFieldBegin(STATE_FIELD_DESC);
oprot.writeString(this.state);
oprot.writeFieldEnd();
}
if (this.message != null) {
oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
oprot.writeString(this.message);
oprot.writeFieldEnd();
}
if (this.cmd != null) {
oprot.writeFieldBegin(CMD_FIELD_DESC);
this.cmd.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
StringBuilder sb = new StringBuilder("CommandStatusThrift(");
boolean first = true;
sb.append("cmdId:");
sb.append(this.cmdId);
first = false;
if (!first) sb.append(", ");
sb.append("state:");
if (this.state == null) {
sb.append("null");
} else {
sb.append(this.state);
}
first = false;
if (!first) sb.append(", ");
sb.append("message:");
if (this.message == null) {
sb.append("null");
} else {
sb.append(this.message);
}
first = false;
if (!first) sb.append(", ");
sb.append("cmd:");
if (this.cmd == null) {
sb.append("null");
} else {
sb.append(this.cmd);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate()
throws TException {
}
}