| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- /**
- * 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 Function implements TBase, java.io.Serializable, Cloneable {
- private static final TStruct STRUCT_DESC = new TStruct("Function");
- private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
- private static final TField CLASS_NAME_FIELD_DESC = new TField("class_name", TType.STRING, (short)2);
- public String name;
- public static final int NAME = 1;
- public String class_name;
- public static final int CLASS_NAME = 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(NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.STRING)));
- put(CLASS_NAME, new FieldMetaData("class_name", TFieldRequirementType.DEFAULT,
- new FieldValueMetaData(TType.STRING)));
- }});
- static {
- FieldMetaData.addStructMetaDataMap(Function.class, metaDataMap);
- }
- public Function() {
- }
- public Function(
- String name,
- String class_name)
- {
- this();
- this.name = name;
- this.class_name = class_name;
- }
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public Function(Function other) {
- if (other.isSetName()) {
- this.name = other.name;
- }
- if (other.isSetClass_name()) {
- this.class_name = other.class_name;
- }
- }
- @Override
- public Function clone() {
- return new Function(this);
- }
- public String getName() {
- return this.name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public void unsetName() {
- this.name = null;
- }
- // Returns true if field name is set (has been asigned a value) and false otherwise
- public boolean isSetName() {
- return this.name != null;
- }
- public void setNameIsSet(boolean value) {
- if (!value) {
- this.name = null;
- }
- }
- public String getClass_name() {
- return this.class_name;
- }
- public void setClass_name(String class_name) {
- this.class_name = class_name;
- }
- public void unsetClass_name() {
- this.class_name = null;
- }
- // Returns true if field class_name is set (has been asigned a value) and false otherwise
- public boolean isSetClass_name() {
- return this.class_name != null;
- }
- public void setClass_nameIsSet(boolean value) {
- if (!value) {
- this.class_name = null;
- }
- }
- public void setFieldValue(int fieldID, Object value) {
- switch (fieldID) {
- case NAME:
- if (value == null) {
- unsetName();
- } else {
- setName((String)value);
- }
- break;
- case CLASS_NAME:
- if (value == null) {
- unsetClass_name();
- } else {
- setClass_name((String)value);
- }
- break;
- default:
- throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
- }
- }
- public Object getFieldValue(int fieldID) {
- switch (fieldID) {
- case NAME:
- return getName();
- case CLASS_NAME:
- return getClass_name();
- 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 NAME:
- return isSetName();
- case CLASS_NAME:
- return isSetClass_name();
- default:
- throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
- }
- }
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof Function)
- return this.equals((Function)that);
- return false;
- }
- public boolean equals(Function that) {
- if (that == null)
- return false;
- boolean this_present_name = true && this.isSetName();
- boolean that_present_name = true && that.isSetName();
- 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_class_name = true && this.isSetClass_name();
- boolean that_present_class_name = true && that.isSetClass_name();
- if (this_present_class_name || that_present_class_name) {
- if (!(this_present_class_name && that_present_class_name))
- return false;
- if (!this.class_name.equals(that.class_name))
- return false;
- }
- return true;
- }
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
- boolean present_name = true && (isSetName());
- builder.append(present_name);
- if (present_name)
- builder.append(name);
- boolean present_class_name = true && (isSetClass_name());
- builder.append(present_class_name);
- if (present_class_name)
- builder.append(class_name);
- 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 NAME:
- if (field.type == TType.STRING) {
- this.name = iprot.readString();
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case CLASS_NAME:
- if (field.type == TType.STRING) {
- this.class_name = 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.name != null) {
- oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeString(this.name);
- oprot.writeFieldEnd();
- }
- if (this.class_name != null) {
- oprot.writeFieldBegin(CLASS_NAME_FIELD_DESC);
- oprot.writeString(this.class_name);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("Function(");
- boolean first = true;
- sb.append("name:");
- if (this.name == null) {
- sb.append("null");
- } else {
- sb.append(this.name);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("class_name:");
- if (this.class_name == null) {
- sb.append("null");
- } else {
- sb.append(this.class_name);
- }
- 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
- }
- }
|