/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.flaptor.indextank.rpc;
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.*;
@SuppressWarnings("all") public class IndexInfo implements TBase<IndexInfo, IndexInfo._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("IndexInfo");
private static final TField CODE_FIELD_DESC = new TField("code", TType.STRING, (short)1);
private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)2);
private static final TField ACCOUNT_EMAIL_FIELD_DESC = new TField("account_email", TType.STRING, (short)3);
private static final TField DOCUMENT_COUNT_FIELD_DESC = new TField("document_count", TType.I32, (short)4);
private String code;
private String name;
private String account_email;
private int document_count;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
CODE((short)1, "code"),
NAME((short)2, "name"),
ACCOUNT_EMAIL((short)3, "account_email"),
DOCUMENT_COUNT((short)4, "document_count");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // CODE
return CODE;
case 2: // NAME
return NAME;
case 3: // ACCOUNT_EMAIL
return ACCOUNT_EMAIL;
case 4: // DOCUMENT_COUNT
return DOCUMENT_COUNT;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __DOCUMENT_COUNT_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.CODE, new FieldMetaData("code", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.ACCOUNT_EMAIL, new FieldMetaData("account_email", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
tmpMap.put(_Fields.DOCUMENT_COUNT, new FieldMetaData("document_count", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(IndexInfo.class, metaDataMap);
}
public IndexInfo() {
}
public IndexInfo(
String code,
String name,
String account_email,
int document_count)
{
this();
this.code = code;
this.name = name;
this.account_email = account_email;
this.document_count = document_count;
set_document_count_isSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public IndexInfo(IndexInfo other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.is_set_code()) {
this.code = other.code;
}
if (other.is_set_name()) {
this.name = other.name;
}
if (other.is_set_account_email()) {
this.account_email = other.account_email;
}
this.document_count = other.document_count;
}
public IndexInfo deepCopy() {
return new IndexInfo(this);
}
@Override
public void clear() {
this.code = null;
this.name = null;
this.account_email = null;
set_document_count_isSet(false);
this.document_count = 0;
}
public String get_code() {
return this.code;
}
public IndexInfo set_code(String code) {
this.code = code;
return this;
}
public void unset_code() {
this.code = null;
}
/** Returns true if field code is set (has been asigned a value) and false otherwise */
public boolean is_set_code() {
return this.code != null;
}
public void set_code_isSet(boolean value) {
if (!value) {
this.code = null;
}
}
public String get_name() {
return this.name;
}
public IndexInfo set_name(String name) {
this.name = name;
return this;
}
public void unset_name() {
this.name = null;
}
/** Returns true if field name is set (has been asigned a value) and false otherwise */
public boolean is_set_name() {
return this.name != null;
}
public void set_name_isSet(boolean value) {
if (!value) {
this.name = null;
}
}
public String get_account_email() {
return this.account_email;
}
public IndexInfo set_account_email(String account_email) {
this.account_email = account_email;
return this;
}
public void unset_account_email() {
this.account_email = null;
}
/** Returns true if field account_email is set (has been asigned a value) and false otherwise */
public boolean is_set_account_email() {
return this.account_email != null;
}
public void set_account_email_isSet(boolean value) {
if (!value) {
this.account_email = null;
}
}
public int get_document_count() {
return this.document_count;
}
public IndexInfo set_document_count(int document_count) {
this.document_count = document_count;
set_document_count_isSet(true);
return this;
}
public void unset_document_count() {
__isset_bit_vector.clear(__DOCUMENT_COUNT_ISSET_ID);
}
/** Returns true if field document_count is set (has been asigned a value) and false otherwise */
public boolean is_set_document_count() {
return __isset_bit_vector.get(__DOCUMENT_COUNT_ISSET_ID);
}
public void set_document_count_isSet(boolean value) {
__isset_bit_vector.set(__DOCUMENT_COUNT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case CODE:
if (value == null) {
unset_code();
} else {
set_code((String)value);
}
break;
case NAME:
if (value == null) {
unset_name();
} else {
set_name((String)value);
}
break;
case ACCOUNT_EMAIL:
if (value == null) {
unset_account_email();
} else {
set_account_email((String)value);
}
break;
case DOCUMENT_COUNT:
if (value == null) {
unset_document_count();
} else {
set_document_count((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case CODE:
return get_code();
case NAME:
return get_name();
case ACCOUNT_EMAIL:
return get_account_email();
case DOCUMENT_COUNT:
return new Integer(get_document_count());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case CODE:
return is_set_code();
case NAME:
return is_set_name();
case ACCOUNT_EMAIL:
return is_set_account_email();
case DOCUMENT_COUNT:
return is_set_document_count();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof IndexInfo)
return this.equals((IndexInfo)that);
return false;
}
public boolean equals(IndexInfo that) {
if (that == null)
return false;
boolean this_present_code = true && this.is_set_code();
boolean that_present_code = true && that.is_set_code();
if (this_present_code || that_present_code) {
if (!(this_present_code && that_present_code))
return false;
if (!this.code.equals(that.code))
return false;
}
boolean this_present_name = true && this.is_set_name();
boolean that_present_name = true && that.is_set_name();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_account_email = true && this.is_set_account_email();
boolean that_present_account_email = true && that.is_set_account_email();
if (this_present_account_email || that_present_account_email) {
if (!(this_present_account_email && that_present_account_email))
return false;
if (!this.account_email.equals(that.account_email))
return false;
}
boolean this_present_document_count = true;
boolean that_present_document_count = true;
if (this_present_document_count || that_present_document_count) {
if (!(this_present_document_count && that_present_document_count))
return false;
if (this.document_count != that.document_count)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(IndexInfo other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
IndexInfo typedOther = (IndexInfo)other;
lastComparison = Boolean.valueOf(is_set_code()).compareTo(typedOther.is_set_code());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_code()) {
lastComparison = TBaseHelper.compareTo(this.code, typedOther.code);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_name()).compareTo(typedOther.is_set_name());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_name()) {
lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_account_email()).compareTo(typedOther.is_set_account_email());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_account_email()) {
lastComparison = TBaseHelper.compareTo(this.account_email, typedOther.account_email);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(is_set_document_count()).compareTo(typedOther.is_set_document_count());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_document_count()) {
lastComparison = TBaseHelper.compareTo(this.document_count, typedOther.document_count);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
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: // CODE
if (field.type == TType.STRING) {
this.code = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // NAME
if (field.type == TType.STRING) {
this.name = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // ACCOUNT_EMAIL
if (field.type == TType.STRING) {
this.account_email = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // DOCUMENT_COUNT
if (field.type == TType.I32) {
this.document_count = iprot.readI32();
set_document_count_isSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
}
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.code != null) {
oprot.writeFieldBegin(CODE_FIELD_DESC);
oprot.writeString(this.code);
oprot.writeFieldEnd();
}
if (this.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeString(this.name);
oprot.writeFieldEnd();
}
if (this.account_email != null) {
oprot.writeFieldBegin(ACCOUNT_EMAIL_FIELD_DESC);
oprot.writeString(this.account_email);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(DOCUMENT_COUNT_FIELD_DESC);
oprot.writeI32(this.document_count);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("IndexInfo(");
boolean first = true;
sb.append("code:");
if (this.code == null) {
sb.append("null");
} else {
sb.append(this.code);
}
first = false;
if (!first) sb.append(", ");
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
sb.append(this.name);
}
first = false;
if (!first) sb.append(", ");
sb.append("account_email:");
if (this.account_email == null) {
sb.append("null");
} else {
sb.append(this.account_email);
}
first = false;
if (!first) sb.append(", ");
sb.append("document_count:");
sb.append(this.document_count);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}