/** * Autogenerated by Thrift Compiler (0.7.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package org.apache.hadoop.corona; 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; public class RestartNodesArgs implements org.apache.thrift.TBase<RestartNodesArgs, RestartNodesArgs._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RestartNodesArgs"); private static final org.apache.thrift.protocol.TField FORCE_FIELD_DESC = new org.apache.thrift.protocol.TField("force", org.apache.thrift.protocol.TType.BOOL, (short)1); private static final org.apache.thrift.protocol.TField BATCH_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("batchSize", org.apache.thrift.protocol.TType.I32, (short)2); public boolean force; // required public int batchSize; // 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 { FORCE((short)1, "force"), BATCH_SIZE((short)2, "batchSize"); 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: // FORCE return FORCE; case 2: // BATCH_SIZE return BATCH_SIZE; 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 __FORCE_ISSET_ID = 0; private static final int __BATCHSIZE_ISSET_ID = 1; private BitSet __isset_bit_vector = new BitSet(2); 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.FORCE, new org.apache.thrift.meta_data.FieldMetaData("force", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.BATCH_SIZE, new org.apache.thrift.meta_data.FieldMetaData("batchSize", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RestartNodesArgs.class, metaDataMap); } public RestartNodesArgs() { } public RestartNodesArgs( boolean force, int batchSize) { this(); this.force = force; setForceIsSet(true); this.batchSize = batchSize; setBatchSizeIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public RestartNodesArgs(RestartNodesArgs other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); this.force = other.force; this.batchSize = other.batchSize; } public RestartNodesArgs deepCopy() { return new RestartNodesArgs(this); } @Override public void clear() { setForceIsSet(false); this.force = false; setBatchSizeIsSet(false); this.batchSize = 0; } public boolean isForce() { return this.force; } public RestartNodesArgs setForce(boolean force) { this.force = force; setForceIsSet(true); return this; } public void unsetForce() { __isset_bit_vector.clear(__FORCE_ISSET_ID); } /** Returns true if field force is set (has been assigned a value) and false otherwise */ public boolean isSetForce() { return __isset_bit_vector.get(__FORCE_ISSET_ID); } public void setForceIsSet(boolean value) { __isset_bit_vector.set(__FORCE_ISSET_ID, value); } public int getBatchSize() { return this.batchSize; } public RestartNodesArgs setBatchSize(int batchSize) { this.batchSize = batchSize; setBatchSizeIsSet(true); return this; } public void unsetBatchSize() { __isset_bit_vector.clear(__BATCHSIZE_ISSET_ID); } /** Returns true if field batchSize is set (has been assigned a value) and false otherwise */ public boolean isSetBatchSize() { return __isset_bit_vector.get(__BATCHSIZE_ISSET_ID); } public void setBatchSizeIsSet(boolean value) { __isset_bit_vector.set(__BATCHSIZE_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case FORCE: if (value == null) { unsetForce(); } else { setForce((Boolean)value); } break; case BATCH_SIZE: if (value == null) { unsetBatchSize(); } else { setBatchSize((Integer)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case FORCE: return Boolean.valueOf(isForce()); case BATCH_SIZE: return Integer.valueOf(getBatchSize()); } 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 FORCE: return isSetForce(); case BATCH_SIZE: return isSetBatchSize(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof RestartNodesArgs) return this.equals((RestartNodesArgs)that); return false; } public boolean equals(RestartNodesArgs that) { if (that == null) return false; boolean this_present_force = true; boolean that_present_force = true; if (this_present_force || that_present_force) { if (!(this_present_force && that_present_force)) return false; if (this.force != that.force) return false; } boolean this_present_batchSize = true; boolean that_present_batchSize = true; if (this_present_batchSize || that_present_batchSize) { if (!(this_present_batchSize && that_present_batchSize)) return false; if (this.batchSize != that.batchSize) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(RestartNodesArgs other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; RestartNodesArgs typedOther = (RestartNodesArgs)other; lastComparison = Boolean.valueOf(isSetForce()).compareTo(typedOther.isSetForce()); if (lastComparison != 0) { return lastComparison; } if (isSetForce()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.force, typedOther.force); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetBatchSize()).compareTo(typedOther.isSetBatchSize()); if (lastComparison != 0) { return lastComparison; } if (isSetBatchSize()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batchSize, typedOther.batchSize); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (field.id) { case 1: // FORCE if (field.type == org.apache.thrift.protocol.TType.BOOL) { this.force = iprot.readBool(); setForceIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 2: // BATCH_SIZE if (field.type == org.apache.thrift.protocol.TType.I32) { this.batchSize = iprot.readI32(); setBatchSizeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; default: org.apache.thrift.protocol.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 if (!isSetForce()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'force' was not found in serialized data! Struct: " + toString()); } if (!isSetBatchSize()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'batchSize' was not found in serialized data! Struct: " + toString()); } validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(FORCE_FIELD_DESC); oprot.writeBool(this.force); oprot.writeFieldEnd(); oprot.writeFieldBegin(BATCH_SIZE_FIELD_DESC); oprot.writeI32(this.batchSize); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("RestartNodesArgs("); boolean first = true; sb.append("force:"); sb.append(this.force); first = false; if (!first) sb.append(", "); sb.append("batchSize:"); sb.append(this.batchSize); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // alas, we cannot check 'force' because it's a primitive and you chose the non-beans generator. // alas, we cannot check 'batchSize' because it's a primitive and you chose the non-beans generator. } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bit_vector = new BitSet(1); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } }