| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604 |
- /**
- * Autogenerated by Thrift
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- */
- package com.cloudera.beeswax.api;
- import org.apache.commons.lang.builder.HashCodeBuilder;
- 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.log4j.Logger;
- import org.apache.thrift.*;
- import org.apache.thrift.meta_data.*;
- import org.apache.thrift.protocol.*;
- public class Results implements TBase, java.io.Serializable, Cloneable {
- private static final TStruct STRUCT_DESC = new TStruct("Results");
- private static final TField READY_FIELD_DESC = new TField("ready", TType.BOOL, (short)1);
- private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)2);
- private static final TField DATA_FIELD_DESC = new TField("data", TType.LIST, (short)3);
- private static final TField START_ROW_FIELD_DESC = new TField("start_row", TType.I64, (short)4);
- private static final TField HAS_MORE_FIELD_DESC = new TField("has_more", TType.BOOL, (short)5);
- public boolean ready;
- public static final int READY = 1;
- public List<String> columns;
- public static final int COLUMNS = 2;
- public List<String> data;
- public static final int DATA = 3;
- public long start_row;
- public static final int START_ROW = 4;
- public boolean has_more;
- public static final int HAS_MORE = 5;
- private final Isset __isset = new Isset();
- private static final class Isset implements java.io.Serializable {
- public boolean ready = false;
- public boolean start_row = false;
- public boolean has_more = false;
- }
- public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
- put(READY, new FieldMetaData("ready", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.BOOL)));
- put(COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT,
- new ListMetaData(TType.LIST,
- new FieldValueMetaData(TType.STRING))));
- put(DATA, new FieldMetaData("data", TFieldRequirementType.DEFAULT,
- new ListMetaData(TType.LIST,
- new FieldValueMetaData(TType.STRING))));
- put(START_ROW, new FieldMetaData("start_row", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.I64)));
- put(HAS_MORE, new FieldMetaData("has_more", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.BOOL)));
- }});
- static {
- FieldMetaData.addStructMetaDataMap(Results.class, metaDataMap);
- }
- public Results() {
- }
- public Results(
- boolean ready,
- List<String> columns,
- List<String> data,
- long start_row,
- boolean has_more)
- {
- this();
- this.ready = ready;
- this.__isset.ready = true;
- this.columns = columns;
- this.data = data;
- this.start_row = start_row;
- this.__isset.start_row = true;
- this.has_more = has_more;
- this.__isset.has_more = true;
- }
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public Results(Results other) {
- __isset.ready = other.__isset.ready;
- this.ready = other.ready;
- if (other.isSetColumns()) {
- List<String> __this__columns = new ArrayList<String>();
- for (String other_element : other.columns) {
- __this__columns.add(other_element);
- }
- this.columns = __this__columns;
- }
- if (other.isSetData()) {
- List<String> __this__data = new ArrayList<String>();
- for (String other_element : other.data) {
- __this__data.add(other_element);
- }
- this.data = __this__data;
- }
- __isset.start_row = other.__isset.start_row;
- this.start_row = other.start_row;
- __isset.has_more = other.__isset.has_more;
- this.has_more = other.has_more;
- }
- @Override
- public Results clone() {
- return new Results(this);
- }
- public boolean isReady() {
- return this.ready;
- }
- public void setReady(boolean ready) {
- this.ready = ready;
- this.__isset.ready = true;
- }
- public void unsetReady() {
- this.__isset.ready = false;
- }
- // Returns true if field ready is set (has been asigned a value) and false otherwise
- public boolean isSetReady() {
- return this.__isset.ready;
- }
- public void setReadyIsSet(boolean value) {
- this.__isset.ready = value;
- }
- public int getColumnsSize() {
- return (this.columns == null) ? 0 : this.columns.size();
- }
- public java.util.Iterator<String> getColumnsIterator() {
- return (this.columns == null) ? null : this.columns.iterator();
- }
- public void addToColumns(String elem) {
- if (this.columns == null) {
- this.columns = new ArrayList<String>();
- }
- this.columns.add(elem);
- }
- public List<String> getColumns() {
- return this.columns;
- }
- public void setColumns(List<String> columns) {
- this.columns = columns;
- }
- public void unsetColumns() {
- this.columns = null;
- }
- // Returns true if field columns is set (has been asigned a value) and false otherwise
- public boolean isSetColumns() {
- return this.columns != null;
- }
- public void setColumnsIsSet(boolean value) {
- if (!value) {
- this.columns = null;
- }
- }
- public int getDataSize() {
- return (this.data == null) ? 0 : this.data.size();
- }
- public java.util.Iterator<String> getDataIterator() {
- return (this.data == null) ? null : this.data.iterator();
- }
- public void addToData(String elem) {
- if (this.data == null) {
- this.data = new ArrayList<String>();
- }
- this.data.add(elem);
- }
- public List<String> getData() {
- return this.data;
- }
- public void setData(List<String> data) {
- this.data = data;
- }
- public void unsetData() {
- this.data = null;
- }
- // Returns true if field data is set (has been asigned a value) and false otherwise
- public boolean isSetData() {
- return this.data != null;
- }
- public void setDataIsSet(boolean value) {
- if (!value) {
- this.data = null;
- }
- }
- public long getStart_row() {
- return this.start_row;
- }
- public void setStart_row(long start_row) {
- this.start_row = start_row;
- this.__isset.start_row = true;
- }
- public void unsetStart_row() {
- this.__isset.start_row = false;
- }
- // Returns true if field start_row is set (has been asigned a value) and false otherwise
- public boolean isSetStart_row() {
- return this.__isset.start_row;
- }
- public void setStart_rowIsSet(boolean value) {
- this.__isset.start_row = value;
- }
- public boolean isHas_more() {
- return this.has_more;
- }
- public void setHas_more(boolean has_more) {
- this.has_more = has_more;
- this.__isset.has_more = true;
- }
- public void unsetHas_more() {
- this.__isset.has_more = false;
- }
- // Returns true if field has_more is set (has been asigned a value) and false otherwise
- public boolean isSetHas_more() {
- return this.__isset.has_more;
- }
- public void setHas_moreIsSet(boolean value) {
- this.__isset.has_more = value;
- }
- public void setFieldValue(int fieldID, Object value) {
- switch (fieldID) {
- case READY:
- if (value == null) {
- unsetReady();
- } else {
- setReady((Boolean)value);
- }
- break;
- case COLUMNS:
- if (value == null) {
- unsetColumns();
- } else {
- setColumns((List<String>)value);
- }
- break;
- case DATA:
- if (value == null) {
- unsetData();
- } else {
- setData((List<String>)value);
- }
- break;
- case START_ROW:
- if (value == null) {
- unsetStart_row();
- } else {
- setStart_row((Long)value);
- }
- break;
- case HAS_MORE:
- if (value == null) {
- unsetHas_more();
- } else {
- setHas_more((Boolean)value);
- }
- break;
- default:
- throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
- }
- }
- public Object getFieldValue(int fieldID) {
- switch (fieldID) {
- case READY:
- return new Boolean(isReady());
- case COLUMNS:
- return getColumns();
- case DATA:
- return getData();
- case START_ROW:
- return new Long(getStart_row());
- case HAS_MORE:
- return new Boolean(isHas_more());
- 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 READY:
- return isSetReady();
- case COLUMNS:
- return isSetColumns();
- case DATA:
- return isSetData();
- case START_ROW:
- return isSetStart_row();
- case HAS_MORE:
- return isSetHas_more();
- default:
- throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
- }
- }
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof Results)
- return this.equals((Results)that);
- return false;
- }
- public boolean equals(Results that) {
- if (that == null)
- return false;
- boolean this_present_ready = true;
- boolean that_present_ready = true;
- if (this_present_ready || that_present_ready) {
- if (!(this_present_ready && that_present_ready))
- return false;
- if (this.ready != that.ready)
- return false;
- }
- boolean this_present_columns = true && this.isSetColumns();
- boolean that_present_columns = true && that.isSetColumns();
- if (this_present_columns || that_present_columns) {
- if (!(this_present_columns && that_present_columns))
- return false;
- if (!this.columns.equals(that.columns))
- return false;
- }
- boolean this_present_data = true && this.isSetData();
- boolean that_present_data = true && that.isSetData();
- if (this_present_data || that_present_data) {
- if (!(this_present_data && that_present_data))
- return false;
- if (!this.data.equals(that.data))
- return false;
- }
- boolean this_present_start_row = true;
- boolean that_present_start_row = true;
- if (this_present_start_row || that_present_start_row) {
- if (!(this_present_start_row && that_present_start_row))
- return false;
- if (this.start_row != that.start_row)
- return false;
- }
- boolean this_present_has_more = true;
- boolean that_present_has_more = true;
- if (this_present_has_more || that_present_has_more) {
- if (!(this_present_has_more && that_present_has_more))
- return false;
- if (this.has_more != that.has_more)
- return false;
- }
- return true;
- }
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
- boolean present_ready = true;
- builder.append(present_ready);
- if (present_ready)
- builder.append(ready);
- boolean present_columns = true && (isSetColumns());
- builder.append(present_columns);
- if (present_columns)
- builder.append(columns);
- boolean present_data = true && (isSetData());
- builder.append(present_data);
- if (present_data)
- builder.append(data);
- boolean present_start_row = true;
- builder.append(present_start_row);
- if (present_start_row)
- builder.append(start_row);
- boolean present_has_more = true;
- builder.append(present_has_more);
- if (present_has_more)
- builder.append(has_more);
- return builder.toHashCode();
- }
- 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 READY:
- if (field.type == TType.BOOL) {
- this.ready = iprot.readBool();
- this.__isset.ready = true;
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case COLUMNS:
- if (field.type == TType.LIST) {
- {
- TList _list8 = iprot.readListBegin();
- this.columns = new ArrayList<String>(_list8.size);
- for (int _i9 = 0; _i9 < _list8.size; ++_i9)
- {
- String _elem10;
- _elem10 = iprot.readString();
- this.columns.add(_elem10);
- }
- iprot.readListEnd();
- }
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case DATA:
- if (field.type == TType.LIST) {
- {
- TList _list11 = iprot.readListBegin();
- this.data = new ArrayList<String>(_list11.size);
- for (int _i12 = 0; _i12 < _list11.size; ++_i12)
- {
- String _elem13;
- _elem13 = iprot.readString();
- this.data.add(_elem13);
- }
- iprot.readListEnd();
- }
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case START_ROW:
- if (field.type == TType.I64) {
- this.start_row = iprot.readI64();
- this.__isset.start_row = true;
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case HAS_MORE:
- if (field.type == TType.BOOL) {
- this.has_more = iprot.readBool();
- this.__isset.has_more = true;
- } 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);
- oprot.writeFieldBegin(READY_FIELD_DESC);
- oprot.writeBool(this.ready);
- oprot.writeFieldEnd();
- if (this.columns != null) {
- oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
- {
- oprot.writeListBegin(new TList(TType.STRING, this.columns.size()));
- for (String _iter14 : this.columns) {
- oprot.writeString(_iter14);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- if (this.data != null) {
- oprot.writeFieldBegin(DATA_FIELD_DESC);
- {
- oprot.writeListBegin(new TList(TType.STRING, this.data.size()));
- for (String _iter15 : this.data) {
- oprot.writeString(_iter15);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(START_ROW_FIELD_DESC);
- oprot.writeI64(this.start_row);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(HAS_MORE_FIELD_DESC);
- oprot.writeBool(this.has_more);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("Results(");
- boolean first = true;
- sb.append("ready:");
- sb.append(this.ready);
- first = false;
- if (!first) sb.append(", ");
- sb.append("columns:");
- if (this.columns == null) {
- sb.append("null");
- } else {
- sb.append(this.columns);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("data:");
- if (this.data == null) {
- sb.append("null");
- } else {
- sb.append(this.data);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("start_row:");
- sb.append(this.start_row);
- first = false;
- if (!first) sb.append(", ");
- sb.append("has_more:");
- sb.append(this.has_more);
- 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
- }
- }
|