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 ValidityCaveats implements org.apache.thrift.TBase<ValidityCaveats, ValidityCaveats._Fields>, java.io.Serializable, Cloneable, Comparable<ValidityCaveats> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( "ValidityCaveats"); private static final org.apache.thrift.protocol.TField ISSUER_FIELD_DESC = new org.apache.thrift.protocol.TField( "issuer", org.apache.thrift.protocol.TType.STRING, (short) 1); private static final org.apache.thrift.protocol.TField ISSUED_TO_FIELD_DESC = new org.apache.thrift.protocol.TField( "issuedTo", org.apache.thrift.protocol.TType.STRING, (short) 2); private static final org.apache.thrift.protocol.TField ISSUED_FOR_FIELD_DESC = new org.apache.thrift.protocol.TField( "issuedFor", org.apache.thrift.protocol.TType.STRING, (short) 3); private static final org.apache.thrift.protocol.TField ISSUED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField( "issuedTime", org.apache.thrift.protocol.TType.I64, (short) 4); private static final org.apache.thrift.protocol.TField NOT_BEFORE_FIELD_DESC = new org.apache.thrift.protocol.TField( "notBefore", org.apache.thrift.protocol.TType.I64, (short) 5); private static final org.apache.thrift.protocol.TField NOT_AFTER_FIELD_DESC = new org.apache.thrift.protocol.TField( "notAfter", org.apache.thrift.protocol.TType.I64, (short) 6); private static final org.apache.thrift.protocol.TField SIGNATURE_FIELD_DESC = new org.apache.thrift.protocol.TField( "signature", org.apache.thrift.protocol.TType.STRING, (short) 7); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new ValidityCaveatsStandardSchemeFactory()); schemes.put(TupleScheme.class, new ValidityCaveatsTupleSchemeFactory()); } public String issuer; // required public String issuedTo; // required public String issuedFor; // optional public long issuedTime; // optional public long notBefore; // optional public long notAfter; // required public String signature; // 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 { ISSUER((short) 1, "issuer"), ISSUED_TO((short) 2, "issuedTo"), ISSUED_FOR((short) 3, "issuedFor"), ISSUED_TIME((short) 4, "issuedTime"), NOT_BEFORE((short) 5, "notBefore"), NOT_AFTER((short) 6, "notAfter"), SIGNATURE((short) 7, "signature"); 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: // ISSUER return ISSUER; case 2: // ISSUED_TO return ISSUED_TO; case 3: // ISSUED_FOR return ISSUED_FOR; case 4: // ISSUED_TIME return ISSUED_TIME; case 5: // NOT_BEFORE return NOT_BEFORE; case 6: // NOT_AFTER return NOT_AFTER; case 7: // SIGNATURE return SIGNATURE; 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 __ISSUEDTIME_ISSET_ID = 0; private static final int __NOTBEFORE_ISSET_ID = 1; private static final int __NOTAFTER_ISSET_ID = 2; private byte __isset_bitfield = 0; private _Fields optionals[] = { _Fields.ISSUED_FOR, _Fields.ISSUED_TIME, _Fields.NOT_BEFORE }; 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.ISSUER, new org.apache.thrift.meta_data.FieldMetaData("issuer", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.ISSUED_TO, new org.apache.thrift.meta_data.FieldMetaData("issuedTo", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.ISSUED_FOR, new org.apache.thrift.meta_data.FieldMetaData("issuedFor", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.ISSUED_TIME, new org.apache.thrift.meta_data.FieldMetaData("issuedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.NOT_BEFORE, new org.apache.thrift.meta_data.FieldMetaData("notBefore", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.NOT_AFTER, new org.apache.thrift.meta_data.FieldMetaData("notAfter", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.SIGNATURE, new org.apache.thrift.meta_data.FieldMetaData("signature", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ValidityCaveats.class, metaDataMap); } public ValidityCaveats() { } public ValidityCaveats(String issuer, String issuedTo, long notAfter, String signature) { this(); this.issuer = issuer; this.issuedTo = issuedTo; this.notAfter = notAfter; setNotAfterIsSet(true); this.signature = signature; } /** * Performs a deep copy on <i>other</i>. */ public ValidityCaveats(ValidityCaveats other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetIssuer()) { this.issuer = other.issuer; } if (other.isSetIssuedTo()) { this.issuedTo = other.issuedTo; } if (other.isSetIssuedFor()) { this.issuedFor = other.issuedFor; } this.issuedTime = other.issuedTime; this.notBefore = other.notBefore; this.notAfter = other.notAfter; if (other.isSetSignature()) { this.signature = other.signature; } } public ValidityCaveats deepCopy() { return new ValidityCaveats(this); } @Override public void clear() { this.issuer = null; this.issuedTo = null; this.issuedFor = null; setIssuedTimeIsSet(false); this.issuedTime = 0; setNotBeforeIsSet(false); this.notBefore = 0; setNotAfterIsSet(false); this.notAfter = 0; this.signature = null; } public String getIssuer() { return this.issuer; } public ValidityCaveats setIssuer(String issuer) { this.issuer = issuer; return this; } public void unsetIssuer() { this.issuer = null; } /** Returns true if field issuer is set (has been assigned a value) and false otherwise */ public boolean isSetIssuer() { return this.issuer != null; } public void setIssuerIsSet(boolean value) { if (!value) { this.issuer = null; } } public String getIssuedTo() { return this.issuedTo; } public ValidityCaveats setIssuedTo(String issuedTo) { this.issuedTo = issuedTo; return this; } public void unsetIssuedTo() { this.issuedTo = null; } /** Returns true if field issuedTo is set (has been assigned a value) and false otherwise */ public boolean isSetIssuedTo() { return this.issuedTo != null; } public void setIssuedToIsSet(boolean value) { if (!value) { this.issuedTo = null; } } public String getIssuedFor() { return this.issuedFor; } public ValidityCaveats setIssuedFor(String issuedFor) { this.issuedFor = issuedFor; return this; } public void unsetIssuedFor() { this.issuedFor = null; } /** Returns true if field issuedFor is set (has been assigned a value) and false otherwise */ public boolean isSetIssuedFor() { return this.issuedFor != null; } public void setIssuedForIsSet(boolean value) { if (!value) { this.issuedFor = null; } } public long getIssuedTime() { return this.issuedTime; } public ValidityCaveats setIssuedTime(long issuedTime) { this.issuedTime = issuedTime; setIssuedTimeIsSet(true); return this; } public void unsetIssuedTime() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISSUEDTIME_ISSET_ID); } /** Returns true if field issuedTime is set (has been assigned a value) and false otherwise */ public boolean isSetIssuedTime() { return EncodingUtils.testBit(__isset_bitfield, __ISSUEDTIME_ISSET_ID); } public void setIssuedTimeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISSUEDTIME_ISSET_ID, value); } public long getNotBefore() { return this.notBefore; } public ValidityCaveats setNotBefore(long notBefore) { this.notBefore = notBefore; setNotBeforeIsSet(true); return this; } public void unsetNotBefore() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NOTBEFORE_ISSET_ID); } /** Returns true if field notBefore is set (has been assigned a value) and false otherwise */ public boolean isSetNotBefore() { return EncodingUtils.testBit(__isset_bitfield, __NOTBEFORE_ISSET_ID); } public void setNotBeforeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NOTBEFORE_ISSET_ID, value); } public long getNotAfter() { return this.notAfter; } public ValidityCaveats setNotAfter(long notAfter) { this.notAfter = notAfter; setNotAfterIsSet(true); return this; } public void unsetNotAfter() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NOTAFTER_ISSET_ID); } /** Returns true if field notAfter is set (has been assigned a value) and false otherwise */ public boolean isSetNotAfter() { return EncodingUtils.testBit(__isset_bitfield, __NOTAFTER_ISSET_ID); } public void setNotAfterIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NOTAFTER_ISSET_ID, value); } public String getSignature() { return this.signature; } public ValidityCaveats setSignature(String signature) { this.signature = signature; return this; } public void unsetSignature() { this.signature = null; } /** Returns true if field signature is set (has been assigned a value) and false otherwise */ public boolean isSetSignature() { return this.signature != null; } public void setSignatureIsSet(boolean value) { if (!value) { this.signature = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case ISSUER: if (value == null) { unsetIssuer(); } else { setIssuer((String) value); } break; case ISSUED_TO: if (value == null) { unsetIssuedTo(); } else { setIssuedTo((String) value); } break; case ISSUED_FOR: if (value == null) { unsetIssuedFor(); } else { setIssuedFor((String) value); } break; case ISSUED_TIME: if (value == null) { unsetIssuedTime(); } else { setIssuedTime((Long) value); } break; case NOT_BEFORE: if (value == null) { unsetNotBefore(); } else { setNotBefore((Long) value); } break; case NOT_AFTER: if (value == null) { unsetNotAfter(); } else { setNotAfter((Long) value); } break; case SIGNATURE: if (value == null) { unsetSignature(); } else { setSignature((String) value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case ISSUER: return getIssuer(); case ISSUED_TO: return getIssuedTo(); case ISSUED_FOR: return getIssuedFor(); case ISSUED_TIME: return Long.valueOf(getIssuedTime()); case NOT_BEFORE: return Long.valueOf(getNotBefore()); case NOT_AFTER: return Long.valueOf(getNotAfter()); case SIGNATURE: return getSignature(); } 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 ISSUER: return isSetIssuer(); case ISSUED_TO: return isSetIssuedTo(); case ISSUED_FOR: return isSetIssuedFor(); case ISSUED_TIME: return isSetIssuedTime(); case NOT_BEFORE: return isSetNotBefore(); case NOT_AFTER: return isSetNotAfter(); case SIGNATURE: return isSetSignature(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof ValidityCaveats) return this.equals((ValidityCaveats) that); return false; } public boolean equals(ValidityCaveats that) { if (that == null) return false; boolean this_present_issuer = true && this.isSetIssuer(); boolean that_present_issuer = true && that.isSetIssuer(); if (this_present_issuer || that_present_issuer) { if (!(this_present_issuer && that_present_issuer)) return false; if (!this.issuer.equals(that.issuer)) return false; } boolean this_present_issuedTo = true && this.isSetIssuedTo(); boolean that_present_issuedTo = true && that.isSetIssuedTo(); if (this_present_issuedTo || that_present_issuedTo) { if (!(this_present_issuedTo && that_present_issuedTo)) return false; if (!this.issuedTo.equals(that.issuedTo)) return false; } boolean this_present_issuedFor = true && this.isSetIssuedFor(); boolean that_present_issuedFor = true && that.isSetIssuedFor(); if (this_present_issuedFor || that_present_issuedFor) { if (!(this_present_issuedFor && that_present_issuedFor)) return false; if (!this.issuedFor.equals(that.issuedFor)) return false; } boolean this_present_issuedTime = true && this.isSetIssuedTime(); boolean that_present_issuedTime = true && that.isSetIssuedTime(); if (this_present_issuedTime || that_present_issuedTime) { if (!(this_present_issuedTime && that_present_issuedTime)) return false; if (this.issuedTime != that.issuedTime) return false; } boolean this_present_notBefore = true && this.isSetNotBefore(); boolean that_present_notBefore = true && that.isSetNotBefore(); if (this_present_notBefore || that_present_notBefore) { if (!(this_present_notBefore && that_present_notBefore)) return false; if (this.notBefore != that.notBefore) return false; } boolean this_present_notAfter = true; boolean that_present_notAfter = true; if (this_present_notAfter || that_present_notAfter) { if (!(this_present_notAfter && that_present_notAfter)) return false; if (this.notAfter != that.notAfter) return false; } boolean this_present_signature = true && this.isSetSignature(); boolean that_present_signature = true && that.isSetSignature(); if (this_present_signature || that_present_signature) { if (!(this_present_signature && that_present_signature)) return false; if (!this.signature.equals(that.signature)) return false; } return true; } @Override public int hashCode() { return 0; } @Override public int compareTo(ValidityCaveats other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetIssuer()).compareTo(other.isSetIssuer()); if (lastComparison != 0) { return lastComparison; } if (isSetIssuer()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuer, other.issuer); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetIssuedTo()).compareTo(other.isSetIssuedTo()); if (lastComparison != 0) { return lastComparison; } if (isSetIssuedTo()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuedTo, other.issuedTo); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetIssuedFor()).compareTo(other.isSetIssuedFor()); if (lastComparison != 0) { return lastComparison; } if (isSetIssuedFor()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuedFor, other.issuedFor); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetIssuedTime()).compareTo(other.isSetIssuedTime()); if (lastComparison != 0) { return lastComparison; } if (isSetIssuedTime()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuedTime, other.issuedTime); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetNotBefore()).compareTo(other.isSetNotBefore()); if (lastComparison != 0) { return lastComparison; } if (isSetNotBefore()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notBefore, other.notBefore); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetNotAfter()).compareTo(other.isSetNotAfter()); if (lastComparison != 0) { return lastComparison; } if (isSetNotAfter()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notAfter, other.notAfter); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSignature()).compareTo(other.isSetSignature()); if (lastComparison != 0) { return lastComparison; } if (isSetSignature()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.signature, other.signature); 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("ValidityCaveats("); boolean first = true; sb.append("issuer:"); if (this.issuer == null) { sb.append("null"); } else { sb.append(this.issuer); } first = false; if (!first) sb.append(", "); sb.append("issuedTo:"); if (this.issuedTo == null) { sb.append("null"); } else { sb.append(this.issuedTo); } first = false; if (isSetIssuedFor()) { if (!first) sb.append(", "); sb.append("issuedFor:"); if (this.issuedFor == null) { sb.append("null"); } else { sb.append(this.issuedFor); } first = false; } if (isSetIssuedTime()) { if (!first) sb.append(", "); sb.append("issuedTime:"); sb.append(this.issuedTime); first = false; } if (isSetNotBefore()) { if (!first) sb.append(", "); sb.append("notBefore:"); sb.append(this.notBefore); first = false; } if (!first) sb.append(", "); sb.append("notAfter:"); sb.append(this.notAfter); first = false; if (!first) sb.append(", "); sb.append("signature:"); if (this.signature == null) { sb.append("null"); } else { sb.append(this.signature); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (issuer == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'issuer' was not present! Struct: " + toString()); } if (issuedTo == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'issuedTo' was not present! Struct: " + toString()); } // alas, we cannot check 'notAfter' because it's a primitive and you chose the non-beans generator. if (signature == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'signature' was not present! Struct: " + toString()); } // check for sub-struct validity } 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 ValidityCaveatsStandardSchemeFactory implements SchemeFactory { public ValidityCaveatsStandardScheme getScheme() { return new ValidityCaveatsStandardScheme(); } } private static class ValidityCaveatsStandardScheme extends StandardScheme<ValidityCaveats> { public void read(org.apache.thrift.protocol.TProtocol iprot, ValidityCaveats 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: // ISSUER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.issuer = iprot.readString(); struct.setIssuerIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // ISSUED_TO if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.issuedTo = iprot.readString(); struct.setIssuedToIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // ISSUED_FOR if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.issuedFor = iprot.readString(); struct.setIssuedForIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // ISSUED_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.issuedTime = iprot.readI64(); struct.setIssuedTimeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // NOT_BEFORE if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.notBefore = iprot.readI64(); struct.setNotBeforeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // NOT_AFTER if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.notAfter = iprot.readI64(); struct.setNotAfterIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // SIGNATURE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.signature = iprot.readString(); struct.setSignatureIsSet(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.isSetNotAfter()) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'notAfter' was not found in serialized data! Struct: " + toString()); } struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, ValidityCaveats struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.issuer != null) { oprot.writeFieldBegin(ISSUER_FIELD_DESC); oprot.writeString(struct.issuer); oprot.writeFieldEnd(); } if (struct.issuedTo != null) { oprot.writeFieldBegin(ISSUED_TO_FIELD_DESC); oprot.writeString(struct.issuedTo); oprot.writeFieldEnd(); } if (struct.issuedFor != null) { if (struct.isSetIssuedFor()) { oprot.writeFieldBegin(ISSUED_FOR_FIELD_DESC); oprot.writeString(struct.issuedFor); oprot.writeFieldEnd(); } } if (struct.isSetIssuedTime()) { oprot.writeFieldBegin(ISSUED_TIME_FIELD_DESC); oprot.writeI64(struct.issuedTime); oprot.writeFieldEnd(); } if (struct.isSetNotBefore()) { oprot.writeFieldBegin(NOT_BEFORE_FIELD_DESC); oprot.writeI64(struct.notBefore); oprot.writeFieldEnd(); } oprot.writeFieldBegin(NOT_AFTER_FIELD_DESC); oprot.writeI64(struct.notAfter); oprot.writeFieldEnd(); if (struct.signature != null) { oprot.writeFieldBegin(SIGNATURE_FIELD_DESC); oprot.writeString(struct.signature); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class ValidityCaveatsTupleSchemeFactory implements SchemeFactory { public ValidityCaveatsTupleScheme getScheme() { return new ValidityCaveatsTupleScheme(); } } private static class ValidityCaveatsTupleScheme extends TupleScheme<ValidityCaveats> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, ValidityCaveats struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.issuer); oprot.writeString(struct.issuedTo); oprot.writeI64(struct.notAfter); oprot.writeString(struct.signature); BitSet optionals = new BitSet(); if (struct.isSetIssuedFor()) { optionals.set(0); } if (struct.isSetIssuedTime()) { optionals.set(1); } if (struct.isSetNotBefore()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetIssuedFor()) { oprot.writeString(struct.issuedFor); } if (struct.isSetIssuedTime()) { oprot.writeI64(struct.issuedTime); } if (struct.isSetNotBefore()) { oprot.writeI64(struct.notBefore); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, ValidityCaveats struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.issuer = iprot.readString(); struct.setIssuerIsSet(true); struct.issuedTo = iprot.readString(); struct.setIssuedToIsSet(true); struct.notAfter = iprot.readI64(); struct.setNotAfterIsSet(true); struct.signature = iprot.readString(); struct.setSignatureIsSet(true); BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.issuedFor = iprot.readString(); struct.setIssuedForIsSet(true); } if (incoming.get(1)) { struct.issuedTime = iprot.readI64(); struct.setIssuedTimeIsSet(true); } if (incoming.get(2)) { struct.notBefore = iprot.readI64(); struct.setNotBeforeIsSet(true); } } } }