Java tutorial
/* Copyright (C) 2013-2014 Computer Sciences Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package ezbake.base.thrift; 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 org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PurgeState implements org.apache.thrift.TBase<PurgeState, PurgeState._Fields>, java.io.Serializable, Cloneable, Comparable<PurgeState> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( "PurgeState"); private static final org.apache.thrift.protocol.TField PURGE_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField( "purgeStatus", org.apache.thrift.protocol.TType.I32, (short) 1); private static final org.apache.thrift.protocol.TField PURGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField( "purgeId", org.apache.thrift.protocol.TType.I64, (short) 2); private static final org.apache.thrift.protocol.TField TIME_STAMP_FIELD_DESC = new org.apache.thrift.protocol.TField( "timeStamp", org.apache.thrift.protocol.TType.STRUCT, (short) 3); private static final org.apache.thrift.protocol.TField PURGED_FIELD_DESC = new org.apache.thrift.protocol.TField( "purged", org.apache.thrift.protocol.TType.SET, (short) 4); private static final org.apache.thrift.protocol.TField NOT_PURGED_FIELD_DESC = new org.apache.thrift.protocol.TField( "notPurged", org.apache.thrift.protocol.TType.SET, (short) 5); private static final org.apache.thrift.protocol.TField SUGGESTED_POLL_PERIOD_FIELD_DESC = new org.apache.thrift.protocol.TField( "suggestedPollPeriod", org.apache.thrift.protocol.TType.I32, (short) 6); private static final org.apache.thrift.protocol.TField CANCEL_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField( "cancelStatus", org.apache.thrift.protocol.TType.I32, (short) 7); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new PurgeStateStandardSchemeFactory()); schemes.put(TupleScheme.class, new PurgeStateTupleSchemeFactory()); } /** * * @see PurgeStatus */ public PurgeStatus purgeStatus; // required public long purgeId; // required public ezbake.base.thrift.DateTime timeStamp; // required public Set<Long> purged; // required public Set<Long> notPurged; // required public int suggestedPollPeriod; // required /** * * @see CancelStatus */ public CancelStatus cancelStatus; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { /** * * @see PurgeStatus */ PURGE_STATUS((short) 1, "purgeStatus"), PURGE_ID((short) 2, "purgeId"), TIME_STAMP((short) 3, "timeStamp"), PURGED((short) 4, "purged"), NOT_PURGED((short) 5, "notPurged"), SUGGESTED_POLL_PERIOD((short) 6, "suggestedPollPeriod"), /** * * @see CancelStatus */ CANCEL_STATUS((short) 7, "cancelStatus"); 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: // PURGE_STATUS return PURGE_STATUS; case 2: // PURGE_ID return PURGE_ID; case 3: // TIME_STAMP return TIME_STAMP; case 4: // PURGED return PURGED; case 5: // NOT_PURGED return NOT_PURGED; case 6: // SUGGESTED_POLL_PERIOD return SUGGESTED_POLL_PERIOD; case 7: // CANCEL_STATUS return CANCEL_STATUS; 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 __PURGEID_ISSET_ID = 0; private static final int __SUGGESTEDPOLLPERIOD_ISSET_ID = 1; private byte __isset_bitfield = 0; private _Fields optionals[] = { _Fields.CANCEL_STATUS }; 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.PURGE_STATUS, new org.apache.thrift.meta_data.FieldMetaData("purgeStatus", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PurgeStatus.class))); tmpMap.put(_Fields.PURGE_ID, new org.apache.thrift.meta_data.FieldMetaData("purgeId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.TIME_STAMP, new org.apache.thrift.meta_data.FieldMetaData("timeStamp", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ezbake.base.thrift.DateTime.class))); tmpMap.put(_Fields.PURGED, new org.apache.thrift.meta_data.FieldMetaData("purged", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)))); tmpMap.put(_Fields.NOT_PURGED, new org.apache.thrift.meta_data.FieldMetaData("notPurged", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)))); tmpMap.put(_Fields.SUGGESTED_POLL_PERIOD, new org.apache.thrift.meta_data.FieldMetaData("suggestedPollPeriod", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.CANCEL_STATUS, new org.apache.thrift.meta_data.FieldMetaData("cancelStatus", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CancelStatus.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PurgeState.class, metaDataMap); } public PurgeState() { this.cancelStatus = ezbake.base.thrift.CancelStatus.NOT_CANCELED; } public PurgeState(PurgeStatus purgeStatus, long purgeId, ezbake.base.thrift.DateTime timeStamp, Set<Long> purged, Set<Long> notPurged, int suggestedPollPeriod) { this(); this.purgeStatus = purgeStatus; this.purgeId = purgeId; setPurgeIdIsSet(true); this.timeStamp = timeStamp; this.purged = purged; this.notPurged = notPurged; this.suggestedPollPeriod = suggestedPollPeriod; setSuggestedPollPeriodIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public PurgeState(PurgeState other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetPurgeStatus()) { this.purgeStatus = other.purgeStatus; } this.purgeId = other.purgeId; if (other.isSetTimeStamp()) { this.timeStamp = new ezbake.base.thrift.DateTime(other.timeStamp); } if (other.isSetPurged()) { Set<Long> __this__purged = new HashSet<Long>(other.purged); this.purged = __this__purged; } if (other.isSetNotPurged()) { Set<Long> __this__notPurged = new HashSet<Long>(other.notPurged); this.notPurged = __this__notPurged; } this.suggestedPollPeriod = other.suggestedPollPeriod; if (other.isSetCancelStatus()) { this.cancelStatus = other.cancelStatus; } } public PurgeState deepCopy() { return new PurgeState(this); } @Override public void clear() { this.purgeStatus = null; setPurgeIdIsSet(false); this.purgeId = 0; this.timeStamp = null; this.purged = null; this.notPurged = null; setSuggestedPollPeriodIsSet(false); this.suggestedPollPeriod = 0; this.cancelStatus = ezbake.base.thrift.CancelStatus.NOT_CANCELED; } /** * * @see PurgeStatus */ public PurgeStatus getPurgeStatus() { return this.purgeStatus; } /** * * @see PurgeStatus */ public PurgeState setPurgeStatus(PurgeStatus purgeStatus) { this.purgeStatus = purgeStatus; return this; } public void unsetPurgeStatus() { this.purgeStatus = null; } /** Returns true if field purgeStatus is set (has been assigned a value) and false otherwise */ public boolean isSetPurgeStatus() { return this.purgeStatus != null; } public void setPurgeStatusIsSet(boolean value) { if (!value) { this.purgeStatus = null; } } public long getPurgeId() { return this.purgeId; } public PurgeState setPurgeId(long purgeId) { this.purgeId = purgeId; setPurgeIdIsSet(true); return this; } public void unsetPurgeId() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PURGEID_ISSET_ID); } /** Returns true if field purgeId is set (has been assigned a value) and false otherwise */ public boolean isSetPurgeId() { return EncodingUtils.testBit(__isset_bitfield, __PURGEID_ISSET_ID); } public void setPurgeIdIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PURGEID_ISSET_ID, value); } public ezbake.base.thrift.DateTime getTimeStamp() { return this.timeStamp; } public PurgeState setTimeStamp(ezbake.base.thrift.DateTime timeStamp) { this.timeStamp = timeStamp; return this; } public void unsetTimeStamp() { this.timeStamp = null; } /** Returns true if field timeStamp is set (has been assigned a value) and false otherwise */ public boolean isSetTimeStamp() { return this.timeStamp != null; } public void setTimeStampIsSet(boolean value) { if (!value) { this.timeStamp = null; } } public int getPurgedSize() { return (this.purged == null) ? 0 : this.purged.size(); } public java.util.Iterator<Long> getPurgedIterator() { return (this.purged == null) ? null : this.purged.iterator(); } public void addToPurged(long elem) { if (this.purged == null) { this.purged = new HashSet<Long>(); } this.purged.add(elem); } public Set<Long> getPurged() { return this.purged; } public PurgeState setPurged(Set<Long> purged) { this.purged = purged; return this; } public void unsetPurged() { this.purged = null; } /** Returns true if field purged is set (has been assigned a value) and false otherwise */ public boolean isSetPurged() { return this.purged != null; } public void setPurgedIsSet(boolean value) { if (!value) { this.purged = null; } } public int getNotPurgedSize() { return (this.notPurged == null) ? 0 : this.notPurged.size(); } public java.util.Iterator<Long> getNotPurgedIterator() { return (this.notPurged == null) ? null : this.notPurged.iterator(); } public void addToNotPurged(long elem) { if (this.notPurged == null) { this.notPurged = new HashSet<Long>(); } this.notPurged.add(elem); } public Set<Long> getNotPurged() { return this.notPurged; } public PurgeState setNotPurged(Set<Long> notPurged) { this.notPurged = notPurged; return this; } public void unsetNotPurged() { this.notPurged = null; } /** Returns true if field notPurged is set (has been assigned a value) and false otherwise */ public boolean isSetNotPurged() { return this.notPurged != null; } public void setNotPurgedIsSet(boolean value) { if (!value) { this.notPurged = null; } } public int getSuggestedPollPeriod() { return this.suggestedPollPeriod; } public PurgeState setSuggestedPollPeriod(int suggestedPollPeriod) { this.suggestedPollPeriod = suggestedPollPeriod; setSuggestedPollPeriodIsSet(true); return this; } public void unsetSuggestedPollPeriod() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUGGESTEDPOLLPERIOD_ISSET_ID); } /** Returns true if field suggestedPollPeriod is set (has been assigned a value) and false otherwise */ public boolean isSetSuggestedPollPeriod() { return EncodingUtils.testBit(__isset_bitfield, __SUGGESTEDPOLLPERIOD_ISSET_ID); } public void setSuggestedPollPeriodIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUGGESTEDPOLLPERIOD_ISSET_ID, value); } /** * * @see CancelStatus */ public CancelStatus getCancelStatus() { return this.cancelStatus; } /** * * @see CancelStatus */ public PurgeState setCancelStatus(CancelStatus cancelStatus) { this.cancelStatus = cancelStatus; return this; } public void unsetCancelStatus() { this.cancelStatus = null; } /** Returns true if field cancelStatus is set (has been assigned a value) and false otherwise */ public boolean isSetCancelStatus() { return this.cancelStatus != null; } public void setCancelStatusIsSet(boolean value) { if (!value) { this.cancelStatus = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case PURGE_STATUS: if (value == null) { unsetPurgeStatus(); } else { setPurgeStatus((PurgeStatus) value); } break; case PURGE_ID: if (value == null) { unsetPurgeId(); } else { setPurgeId((Long) value); } break; case TIME_STAMP: if (value == null) { unsetTimeStamp(); } else { setTimeStamp((ezbake.base.thrift.DateTime) value); } break; case PURGED: if (value == null) { unsetPurged(); } else { setPurged((Set<Long>) value); } break; case NOT_PURGED: if (value == null) { unsetNotPurged(); } else { setNotPurged((Set<Long>) value); } break; case SUGGESTED_POLL_PERIOD: if (value == null) { unsetSuggestedPollPeriod(); } else { setSuggestedPollPeriod((Integer) value); } break; case CANCEL_STATUS: if (value == null) { unsetCancelStatus(); } else { setCancelStatus((CancelStatus) value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case PURGE_STATUS: return getPurgeStatus(); case PURGE_ID: return Long.valueOf(getPurgeId()); case TIME_STAMP: return getTimeStamp(); case PURGED: return getPurged(); case NOT_PURGED: return getNotPurged(); case SUGGESTED_POLL_PERIOD: return Integer.valueOf(getSuggestedPollPeriod()); case CANCEL_STATUS: return getCancelStatus(); } 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 PURGE_STATUS: return isSetPurgeStatus(); case PURGE_ID: return isSetPurgeId(); case TIME_STAMP: return isSetTimeStamp(); case PURGED: return isSetPurged(); case NOT_PURGED: return isSetNotPurged(); case SUGGESTED_POLL_PERIOD: return isSetSuggestedPollPeriod(); case CANCEL_STATUS: return isSetCancelStatus(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof PurgeState) return this.equals((PurgeState) that); return false; } public boolean equals(PurgeState that) { if (that == null) return false; boolean this_present_purgeStatus = true && this.isSetPurgeStatus(); boolean that_present_purgeStatus = true && that.isSetPurgeStatus(); if (this_present_purgeStatus || that_present_purgeStatus) { if (!(this_present_purgeStatus && that_present_purgeStatus)) return false; if (!this.purgeStatus.equals(that.purgeStatus)) return false; } boolean this_present_purgeId = true; boolean that_present_purgeId = true; if (this_present_purgeId || that_present_purgeId) { if (!(this_present_purgeId && that_present_purgeId)) return false; if (this.purgeId != that.purgeId) return false; } boolean this_present_timeStamp = true && this.isSetTimeStamp(); boolean that_present_timeStamp = true && that.isSetTimeStamp(); if (this_present_timeStamp || that_present_timeStamp) { if (!(this_present_timeStamp && that_present_timeStamp)) return false; if (!this.timeStamp.equals(that.timeStamp)) return false; } boolean this_present_purged = true && this.isSetPurged(); boolean that_present_purged = true && that.isSetPurged(); if (this_present_purged || that_present_purged) { if (!(this_present_purged && that_present_purged)) return false; if (!this.purged.equals(that.purged)) return false; } boolean this_present_notPurged = true && this.isSetNotPurged(); boolean that_present_notPurged = true && that.isSetNotPurged(); if (this_present_notPurged || that_present_notPurged) { if (!(this_present_notPurged && that_present_notPurged)) return false; if (!this.notPurged.equals(that.notPurged)) return false; } boolean this_present_suggestedPollPeriod = true; boolean that_present_suggestedPollPeriod = true; if (this_present_suggestedPollPeriod || that_present_suggestedPollPeriod) { if (!(this_present_suggestedPollPeriod && that_present_suggestedPollPeriod)) return false; if (this.suggestedPollPeriod != that.suggestedPollPeriod) return false; } boolean this_present_cancelStatus = true && this.isSetCancelStatus(); boolean that_present_cancelStatus = true && that.isSetCancelStatus(); if (this_present_cancelStatus || that_present_cancelStatus) { if (!(this_present_cancelStatus && that_present_cancelStatus)) return false; if (!this.cancelStatus.equals(that.cancelStatus)) return false; } return true; } @Override public int hashCode() { return 0; } @Override public int compareTo(PurgeState other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetPurgeStatus()).compareTo(other.isSetPurgeStatus()); if (lastComparison != 0) { return lastComparison; } if (isSetPurgeStatus()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.purgeStatus, other.purgeStatus); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPurgeId()).compareTo(other.isSetPurgeId()); if (lastComparison != 0) { return lastComparison; } if (isSetPurgeId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.purgeId, other.purgeId); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetTimeStamp()).compareTo(other.isSetTimeStamp()); if (lastComparison != 0) { return lastComparison; } if (isSetTimeStamp()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeStamp, other.timeStamp); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPurged()).compareTo(other.isSetPurged()); if (lastComparison != 0) { return lastComparison; } if (isSetPurged()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.purged, other.purged); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetNotPurged()).compareTo(other.isSetNotPurged()); if (lastComparison != 0) { return lastComparison; } if (isSetNotPurged()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notPurged, other.notPurged); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSuggestedPollPeriod()).compareTo(other.isSetSuggestedPollPeriod()); if (lastComparison != 0) { return lastComparison; } if (isSetSuggestedPollPeriod()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.suggestedPollPeriod, other.suggestedPollPeriod); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetCancelStatus()).compareTo(other.isSetCancelStatus()); if (lastComparison != 0) { return lastComparison; } if (isSetCancelStatus()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cancelStatus, other.cancelStatus); 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 { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("PurgeState("); boolean first = true; sb.append("purgeStatus:"); if (this.purgeStatus == null) { sb.append("null"); } else { sb.append(this.purgeStatus); } first = false; if (!first) sb.append(", "); sb.append("purgeId:"); sb.append(this.purgeId); first = false; if (!first) sb.append(", "); sb.append("timeStamp:"); if (this.timeStamp == null) { sb.append("null"); } else { sb.append(this.timeStamp); } first = false; if (!first) sb.append(", "); sb.append("purged:"); if (this.purged == null) { sb.append("null"); } else { sb.append(this.purged); } first = false; if (!first) sb.append(", "); sb.append("notPurged:"); if (this.notPurged == null) { sb.append("null"); } else { sb.append(this.notPurged); } first = false; if (!first) sb.append(", "); sb.append("suggestedPollPeriod:"); sb.append(this.suggestedPollPeriod); first = false; if (isSetCancelStatus()) { if (!first) sb.append(", "); sb.append("cancelStatus:"); if (this.cancelStatus == null) { sb.append("null"); } else { sb.append(this.cancelStatus); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (purgeStatus == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'purgeStatus' was not present! Struct: " + toString()); } // alas, we cannot check 'purgeId' because it's a primitive and you chose the non-beans generator. if (timeStamp == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'timeStamp' was not present! Struct: " + toString()); } if (purged == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'purged' was not present! Struct: " + toString()); } if (notPurged == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'notPurged' was not present! Struct: " + toString()); } // alas, we cannot check 'suggestedPollPeriod' because it's a primitive and you chose the non-beans generator. // check for sub-struct validity if (timeStamp != null) { timeStamp.validate(); } } 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_bitfield = 0; 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); } } private static class PurgeStateStandardSchemeFactory implements SchemeFactory { public PurgeStateStandardScheme getScheme() { return new PurgeStateStandardScheme(); } } private static class PurgeStateStandardScheme extends StandardScheme<PurgeState> { public void read(org.apache.thrift.protocol.TProtocol iprot, PurgeState struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // PURGE_STATUS if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.purgeStatus = PurgeStatus.findByValue(iprot.readI32()); struct.setPurgeStatusIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // PURGE_ID if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.purgeId = iprot.readI64(); struct.setPurgeIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // TIME_STAMP if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.timeStamp = new ezbake.base.thrift.DateTime(); struct.timeStamp.read(iprot); struct.setTimeStampIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // PURGED if (schemeField.type == org.apache.thrift.protocol.TType.SET) { { org.apache.thrift.protocol.TSet _set0 = iprot.readSetBegin(); struct.purged = new HashSet<Long>(2 * _set0.size); for (int _i1 = 0; _i1 < _set0.size; ++_i1) { long _elem2; _elem2 = iprot.readI64(); struct.purged.add(_elem2); } iprot.readSetEnd(); } struct.setPurgedIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // NOT_PURGED if (schemeField.type == org.apache.thrift.protocol.TType.SET) { { org.apache.thrift.protocol.TSet _set3 = iprot.readSetBegin(); struct.notPurged = new HashSet<Long>(2 * _set3.size); for (int _i4 = 0; _i4 < _set3.size; ++_i4) { long _elem5; _elem5 = iprot.readI64(); struct.notPurged.add(_elem5); } iprot.readSetEnd(); } struct.setNotPurgedIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // SUGGESTED_POLL_PERIOD if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.suggestedPollPeriod = iprot.readI32(); struct.setSuggestedPollPeriodIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // CANCEL_STATUS if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.cancelStatus = CancelStatus.findByValue(iprot.readI32()); struct.setCancelStatusIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method if (!struct.isSetPurgeId()) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'purgeId' was not found in serialized data! Struct: " + toString()); } if (!struct.isSetSuggestedPollPeriod()) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'suggestedPollPeriod' was not found in serialized data! Struct: " + toString()); } struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, PurgeState struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.purgeStatus != null) { oprot.writeFieldBegin(PURGE_STATUS_FIELD_DESC); oprot.writeI32(struct.purgeStatus.getValue()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(PURGE_ID_FIELD_DESC); oprot.writeI64(struct.purgeId); oprot.writeFieldEnd(); if (struct.timeStamp != null) { oprot.writeFieldBegin(TIME_STAMP_FIELD_DESC); struct.timeStamp.write(oprot); oprot.writeFieldEnd(); } if (struct.purged != null) { oprot.writeFieldBegin(PURGED_FIELD_DESC); { oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, struct.purged.size())); for (long _iter6 : struct.purged) { oprot.writeI64(_iter6); } oprot.writeSetEnd(); } oprot.writeFieldEnd(); } if (struct.notPurged != null) { oprot.writeFieldBegin(NOT_PURGED_FIELD_DESC); { oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I64, struct.notPurged.size())); for (long _iter7 : struct.notPurged) { oprot.writeI64(_iter7); } oprot.writeSetEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldBegin(SUGGESTED_POLL_PERIOD_FIELD_DESC); oprot.writeI32(struct.suggestedPollPeriod); oprot.writeFieldEnd(); if (struct.cancelStatus != null) { if (struct.isSetCancelStatus()) { oprot.writeFieldBegin(CANCEL_STATUS_FIELD_DESC); oprot.writeI32(struct.cancelStatus.getValue()); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class PurgeStateTupleSchemeFactory implements SchemeFactory { public PurgeStateTupleScheme getScheme() { return new PurgeStateTupleScheme(); } } private static class PurgeStateTupleScheme extends TupleScheme<PurgeState> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, PurgeState struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI32(struct.purgeStatus.getValue()); oprot.writeI64(struct.purgeId); struct.timeStamp.write(oprot); { oprot.writeI32(struct.purged.size()); for (long _iter8 : struct.purged) { oprot.writeI64(_iter8); } } { oprot.writeI32(struct.notPurged.size()); for (long _iter9 : struct.notPurged) { oprot.writeI64(_iter9); } } oprot.writeI32(struct.suggestedPollPeriod); BitSet optionals = new BitSet(); if (struct.isSetCancelStatus()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetCancelStatus()) { oprot.writeI32(struct.cancelStatus.getValue()); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, PurgeState struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.purgeStatus = PurgeStatus.findByValue(iprot.readI32()); struct.setPurgeStatusIsSet(true); struct.purgeId = iprot.readI64(); struct.setPurgeIdIsSet(true); struct.timeStamp = new ezbake.base.thrift.DateTime(); struct.timeStamp.read(iprot); struct.setTimeStampIsSet(true); { org.apache.thrift.protocol.TSet _set10 = new org.apache.thrift.protocol.TSet( org.apache.thrift.protocol.TType.I64, iprot.readI32()); struct.purged = new HashSet<Long>(2 * _set10.size); for (int _i11 = 0; _i11 < _set10.size; ++_i11) { long _elem12; _elem12 = iprot.readI64(); struct.purged.add(_elem12); } } struct.setPurgedIsSet(true); { org.apache.thrift.protocol.TSet _set13 = new org.apache.thrift.protocol.TSet( org.apache.thrift.protocol.TType.I64, iprot.readI32()); struct.notPurged = new HashSet<Long>(2 * _set13.size); for (int _i14 = 0; _i14 < _set13.size; ++_i14) { long _elem15; _elem15 = iprot.readI64(); struct.notPurged.add(_elem15); } } struct.setNotPurgedIsSet(true); struct.suggestedPollPeriod = iprot.readI32(); struct.setSuggestedPollPeriodIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.cancelStatus = CancelStatus.findByValue(iprot.readI32()); struct.setCancelStatusIsSet(true); } } } }