/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package org.thrudb;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;
public class logEntry implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("logEntry");
private static final TField LSN_FIELD_DESC = new TField("lsn", TType.STRING, (short)1);
private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)2);
public String lsn;
public static final int LSN = 1;
public byte[] message;
public static final int MESSAGE = 2;
private final Isset __isset = new Isset();
private static final class Isset implements java.io.Serializable {
}
public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
put(LSN, new FieldMetaData("lsn", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
put(MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
}});
static {
FieldMetaData.addStructMetaDataMap(logEntry.class, metaDataMap);
}
public logEntry() {
}
public logEntry(
String lsn,
byte[] message)
{
this();
this.lsn = lsn;
this.message = message;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public logEntry(logEntry other) {
if (other.isSetLsn()) {
this.lsn = other.lsn;
}
if (other.isSetMessage()) {
this.message = new byte[other.message.length];
System.arraycopy(other.message, 0, message, 0, other.message.length);
}
}
@Override
public logEntry clone() {
return new logEntry(this);
}
public String getLsn() {
return this.lsn;
}
public void setLsn(String lsn) {
this.lsn = lsn;
}
public void unsetLsn() {
this.lsn = null;
}
// Returns true if field lsn is set (has been asigned a value) and false otherwise
public boolean isSetLsn() {
return this.lsn != null;
}
public void setLsnIsSet(boolean value) {
if (!value) {
this.lsn = null;
}
}
public byte[] getMessage() {
return this.message;
}
public void setMessage(byte[] message) {
this.message = message;
}
public void unsetMessage() {
this.message = null;
}
// Returns true if field message is set (has been asigned a value) and false otherwise
public boolean isSetMessage() {
return this.message != null;
}
public void setMessageIsSet(boolean value) {
if (!value) {
this.message = null;
}
}
public void setFieldValue(int fieldID, Object value) {
switch (fieldID) {
case LSN:
if (value == null) {
unsetLsn();
} else {
setLsn((String)value);
}
break;
case MESSAGE:
if (value == null) {
unsetMessage();
} else {
setMessage((byte[])value);
}
break;
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
}
public Object getFieldValue(int fieldID) {
switch (fieldID) {
case LSN:
return getLsn();
case MESSAGE:
return getMessage();
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
}
// Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
public boolean isSet(int fieldID) {
switch (fieldID) {
case LSN:
return isSetLsn();
case MESSAGE:
return isSetMessage();
default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof logEntry)
return this.equals((logEntry)that);
return false;
}
public boolean equals(logEntry that) {
if (that == null)
return false;
boolean this_present_lsn = true && this.isSetLsn();
boolean that_present_lsn = true && that.isSetLsn();
if (this_present_lsn || that_present_lsn) {
if (!(this_present_lsn && that_present_lsn))
return false;
if (!this.lsn.equals(that.lsn))
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 (!java.util.Arrays.equals(this.message, that.message))
return false;
}
return true;
}
@Override
public int hashCode() {
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 LSN:
if (field.type == TType.STRING) {
this.lsn = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case MESSAGE:
if (field.type == TType.STRING) {
this.message = iprot.readBinary();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
break;
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.lsn != null) {
oprot.writeFieldBegin(LSN_FIELD_DESC);
oprot.writeString(this.lsn);
oprot.writeFieldEnd();
}
if (this.message != null) {
oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
oprot.writeBinary(this.message);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("logEntry(");
boolean first = true;
sb.append("lsn:");
if (this.lsn == null) {
sb.append("null");
} else {
sb.append(this.lsn);
}
first = false;
if (!first) sb.append(", ");
sb.append("message:");
if (this.message == null) {
sb.append("null");
} else {
int __message_size = Math.min(this.message.length, 128);
for (int i = 0; i < __message_size; i++) {
if (i != 0) sb.append(" ");
sb.append(Integer.toHexString(this.message[i]).length() > 1 ? Integer.toHexString(this.message[i]).substring(Integer.toHexString(this.message[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.message[i]).toUpperCase());
}
if (this.message.length > 128) sb.append(" ...");
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
// check that fields of type enum have valid values
}
}