org.apache.hadoop.hive.serde.test.ThriftTestObj Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hive.serde.test;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
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 javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
public class ThriftTestObj implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftTestObj");
private static final org.apache.thrift.protocol.TField FIELD1_FIELD_DESC = new org.apache.thrift.protocol.TField("field1", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField FIELD2_FIELD_DESC = new org.apache.thrift.protocol.TField("field2", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField FIELD3_FIELD_DESC = new org.apache.thrift.protocol.TField("field3", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ThriftTestObjStandardSchemeFactory());
schemes.put(TupleScheme.class, new ThriftTestObjTupleSchemeFactory());
}
private int field1; // required
private String field2; // required
private List field3; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
FIELD1((short)1, "field1"),
FIELD2((short)2, "field2"),
FIELD3((short)3, "field3");
private static final Map byName = new HashMap();
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: // FIELD1
return FIELD1;
case 2: // FIELD2
return FIELD2;
case 3: // FIELD3
return FIELD3;
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 __FIELD1_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.FIELD1, new org.apache.thrift.meta_data.FieldMetaData("field1", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.FIELD2, new org.apache.thrift.meta_data.FieldMetaData("field2", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.FIELD3, new org.apache.thrift.meta_data.FieldMetaData("field3", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, InnerStruct.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftTestObj.class, metaDataMap);
}
public ThriftTestObj() {
}
public ThriftTestObj(
int field1,
String field2,
List field3)
{
this();
this.field1 = field1;
setField1IsSet(true);
this.field2 = field2;
this.field3 = field3;
}
/**
* Performs a deep copy on other.
*/
public ThriftTestObj(ThriftTestObj other) {
__isset_bitfield = other.__isset_bitfield;
this.field1 = other.field1;
if (other.isSetField2()) {
this.field2 = other.field2;
}
if (other.isSetField3()) {
List __this__field3 = new ArrayList(other.field3.size());
for (InnerStruct other_element : other.field3) {
__this__field3.add(new InnerStruct(other_element));
}
this.field3 = __this__field3;
}
}
public ThriftTestObj deepCopy() {
return new ThriftTestObj(this);
}
@Override
public void clear() {
setField1IsSet(false);
this.field1 = 0;
this.field2 = null;
this.field3 = null;
}
public int getField1() {
return this.field1;
}
public void setField1(int field1) {
this.field1 = field1;
setField1IsSet(true);
}
public void unsetField1() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FIELD1_ISSET_ID);
}
/** Returns true if field field1 is set (has been assigned a value) and false otherwise */
public boolean isSetField1() {
return EncodingUtils.testBit(__isset_bitfield, __FIELD1_ISSET_ID);
}
public void setField1IsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FIELD1_ISSET_ID, value);
}
public String getField2() {
return this.field2;
}
public void setField2(String field2) {
this.field2 = field2;
}
public void unsetField2() {
this.field2 = null;
}
/** Returns true if field field2 is set (has been assigned a value) and false otherwise */
public boolean isSetField2() {
return this.field2 != null;
}
public void setField2IsSet(boolean value) {
if (!value) {
this.field2 = null;
}
}
public int getField3Size() {
return (this.field3 == null) ? 0 : this.field3.size();
}
public java.util.Iterator getField3Iterator() {
return (this.field3 == null) ? null : this.field3.iterator();
}
public void addToField3(InnerStruct elem) {
if (this.field3 == null) {
this.field3 = new ArrayList();
}
this.field3.add(elem);
}
public List getField3() {
return this.field3;
}
public void setField3(List field3) {
this.field3 = field3;
}
public void unsetField3() {
this.field3 = null;
}
/** Returns true if field field3 is set (has been assigned a value) and false otherwise */
public boolean isSetField3() {
return this.field3 != null;
}
public void setField3IsSet(boolean value) {
if (!value) {
this.field3 = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case FIELD1:
if (value == null) {
unsetField1();
} else {
setField1((Integer)value);
}
break;
case FIELD2:
if (value == null) {
unsetField2();
} else {
setField2((String)value);
}
break;
case FIELD3:
if (value == null) {
unsetField3();
} else {
setField3((List)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case FIELD1:
return getField1();
case FIELD2:
return getField2();
case FIELD3:
return getField3();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case FIELD1:
return isSetField1();
case FIELD2:
return isSetField2();
case FIELD3:
return isSetField3();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ThriftTestObj)
return this.equals((ThriftTestObj)that);
return false;
}
public boolean equals(ThriftTestObj that) {
if (that == null)
return false;
boolean this_present_field1 = true;
boolean that_present_field1 = true;
if (this_present_field1 || that_present_field1) {
if (!(this_present_field1 && that_present_field1))
return false;
if (this.field1 != that.field1)
return false;
}
boolean this_present_field2 = true && this.isSetField2();
boolean that_present_field2 = true && that.isSetField2();
if (this_present_field2 || that_present_field2) {
if (!(this_present_field2 && that_present_field2))
return false;
if (!this.field2.equals(that.field2))
return false;
}
boolean this_present_field3 = true && this.isSetField3();
boolean that_present_field3 = true && that.isSetField3();
if (this_present_field3 || that_present_field3) {
if (!(this_present_field3 && that_present_field3))
return false;
if (!this.field3.equals(that.field3))
return false;
}
return true;
}
@Override
public int hashCode() {
List