| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- /**
- * 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.*;
- /**
- * Represents a Hadoop-style configuration variable.
- */
- public class ConfigVariable implements TBase, java.io.Serializable, Cloneable {
- private static final TStruct STRUCT_DESC = new TStruct("ConfigVariable");
- private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)1);
- private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)2);
- private static final TField DESCRIPTION_FIELD_DESC = new TField("description", TType.STRING, (short)3);
- public String key;
- public static final int KEY = 1;
- public String value;
- public static final int VALUE = 2;
- public String description;
- public static final int DESCRIPTION = 3;
- 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(KEY, new FieldMetaData("key", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.STRING)));
- put(VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.STRING)));
- put(DESCRIPTION, new FieldMetaData("description", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.STRING)));
- }});
- static {
- FieldMetaData.addStructMetaDataMap(ConfigVariable.class, metaDataMap);
- }
- public ConfigVariable() {
- }
- public ConfigVariable(
- String key,
- String value,
- String description)
- {
- this();
- this.key = key;
- this.value = value;
- this.description = description;
- }
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public ConfigVariable(ConfigVariable other) {
- if (other.isSetKey()) {
- this.key = other.key;
- }
- if (other.isSetValue()) {
- this.value = other.value;
- }
- if (other.isSetDescription()) {
- this.description = other.description;
- }
- }
- @Override
- public ConfigVariable clone() {
- return new ConfigVariable(this);
- }
- public String getKey() {
- return this.key;
- }
- public void setKey(String key) {
- this.key = key;
- }
- public void unsetKey() {
- this.key = null;
- }
- // Returns true if field key is set (has been asigned a value) and false otherwise
- public boolean isSetKey() {
- return this.key != null;
- }
- public void setKeyIsSet(boolean value) {
- if (!value) {
- this.key = null;
- }
- }
- public String getValue() {
- return this.value;
- }
- public void setValue(String value) {
- this.value = value;
- }
- public void unsetValue() {
- this.value = null;
- }
- // Returns true if field value is set (has been asigned a value) and false otherwise
- public boolean isSetValue() {
- return this.value != null;
- }
- public void setValueIsSet(boolean value) {
- if (!value) {
- this.value = null;
- }
- }
- public String getDescription() {
- return this.description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public void unsetDescription() {
- this.description = null;
- }
- // Returns true if field description is set (has been asigned a value) and false otherwise
- public boolean isSetDescription() {
- return this.description != null;
- }
- public void setDescriptionIsSet(boolean value) {
- if (!value) {
- this.description = null;
- }
- }
- public void setFieldValue(int fieldID, Object value) {
- switch (fieldID) {
- case KEY:
- if (value == null) {
- unsetKey();
- } else {
- setKey((String)value);
- }
- break;
- case VALUE:
- if (value == null) {
- unsetValue();
- } else {
- setValue((String)value);
- }
- break;
- case DESCRIPTION:
- if (value == null) {
- unsetDescription();
- } else {
- setDescription((String)value);
- }
- break;
- default:
- throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
- }
- }
- public Object getFieldValue(int fieldID) {
- switch (fieldID) {
- case KEY:
- return getKey();
- case VALUE:
- return getValue();
- case DESCRIPTION:
- return getDescription();
- 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 KEY:
- return isSetKey();
- case VALUE:
- return isSetValue();
- case DESCRIPTION:
- return isSetDescription();
- default:
- throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
- }
- }
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof ConfigVariable)
- return this.equals((ConfigVariable)that);
- return false;
- }
- public boolean equals(ConfigVariable that) {
- if (that == null)
- return false;
- boolean this_present_key = true && this.isSetKey();
- boolean that_present_key = true && that.isSetKey();
- if (this_present_key || that_present_key) {
- if (!(this_present_key && that_present_key))
- return false;
- if (!this.key.equals(that.key))
- return false;
- }
- boolean this_present_value = true && this.isSetValue();
- boolean that_present_value = true && that.isSetValue();
- if (this_present_value || that_present_value) {
- if (!(this_present_value && that_present_value))
- return false;
- if (!this.value.equals(that.value))
- return false;
- }
- boolean this_present_description = true && this.isSetDescription();
- boolean that_present_description = true && that.isSetDescription();
- if (this_present_description || that_present_description) {
- if (!(this_present_description && that_present_description))
- return false;
- if (!this.description.equals(that.description))
- return false;
- }
- return true;
- }
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
- boolean present_key = true && (isSetKey());
- builder.append(present_key);
- if (present_key)
- builder.append(key);
- boolean present_value = true && (isSetValue());
- builder.append(present_value);
- if (present_value)
- builder.append(value);
- boolean present_description = true && (isSetDescription());
- builder.append(present_description);
- if (present_description)
- builder.append(description);
- 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 KEY:
- if (field.type == TType.STRING) {
- this.key = iprot.readString();
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case VALUE:
- if (field.type == TType.STRING) {
- this.value = iprot.readString();
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case DESCRIPTION:
- if (field.type == TType.STRING) {
- this.description = iprot.readString();
- } 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.key != null) {
- oprot.writeFieldBegin(KEY_FIELD_DESC);
- oprot.writeString(this.key);
- oprot.writeFieldEnd();
- }
- if (this.value != null) {
- oprot.writeFieldBegin(VALUE_FIELD_DESC);
- oprot.writeString(this.value);
- oprot.writeFieldEnd();
- }
- if (this.description != null) {
- oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
- oprot.writeString(this.description);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("ConfigVariable(");
- boolean first = true;
- sb.append("key:");
- if (this.key == null) {
- sb.append("null");
- } else {
- sb.append(this.key);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("value:");
- if (this.value == null) {
- sb.append("null");
- } else {
- sb.append(this.value);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("description:");
- if (this.description == null) {
- sb.append("null");
- } else {
- sb.append(this.description);
- }
- 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
- }
- }
|