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 ProxyUserToken implements org.apache.thrift.TBase<ProxyUserToken, ProxyUserToken._Fields>, java.io.Serializable, Cloneable, Comparable<ProxyUserToken> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( "ProxyUserToken"); private static final org.apache.thrift.protocol.TField X509_FIELD_DESC = new org.apache.thrift.protocol.TField( "x509", org.apache.thrift.protocol.TType.STRUCT, (short) 1); private static final org.apache.thrift.protocol.TField ISSUED_BY_FIELD_DESC = new org.apache.thrift.protocol.TField( "issuedBy", org.apache.thrift.protocol.TType.STRING, (short) 10); 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) 11); 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) 12); 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) 13); 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) 14); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new ProxyUserTokenStandardSchemeFactory()); schemes.put(TupleScheme.class, new ProxyUserTokenTupleSchemeFactory()); } public X509Info x509; // required public String issuedBy; // required public String issuedTo; // required public String issuedFor; // optional public long notAfter; // required public long notBefore; // 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 { X509((short) 1, "x509"), ISSUED_BY((short) 10, "issuedBy"), ISSUED_TO((short) 11, "issuedTo"), ISSUED_FOR( (short) 12, "issuedFor"), NOT_AFTER((short) 13, "notAfter"), NOT_BEFORE((short) 14, "notBefore"); 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: // X509 return X509; case 10: // ISSUED_BY return ISSUED_BY; case 11: // ISSUED_TO return ISSUED_TO; case 12: // ISSUED_FOR return ISSUED_FOR; case 13: // NOT_AFTER return NOT_AFTER; case 14: // NOT_BEFORE return NOT_BEFORE; 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 __NOTAFTER_ISSET_ID = 0; private static final int __NOTBEFORE_ISSET_ID = 1; private byte __isset_bitfield = 0; private _Fields optionals[] = { _Fields.ISSUED_FOR, _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.X509, new org.apache.thrift.meta_data.FieldMetaData("x509", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, X509Info.class))); tmpMap.put(_Fields.ISSUED_BY, new org.apache.thrift.meta_data.FieldMetaData("issuedBy", 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.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.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))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ProxyUserToken.class, metaDataMap); } public ProxyUserToken() { } public ProxyUserToken(X509Info x509, String issuedBy, String issuedTo, long notAfter) { this(); this.x509 = x509; this.issuedBy = issuedBy; this.issuedTo = issuedTo; this.notAfter = notAfter; setNotAfterIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public ProxyUserToken(ProxyUserToken other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetX509()) { this.x509 = new X509Info(other.x509); } if (other.isSetIssuedBy()) { this.issuedBy = other.issuedBy; } if (other.isSetIssuedTo()) { this.issuedTo = other.issuedTo; } if (other.isSetIssuedFor()) { this.issuedFor = other.issuedFor; } this.notAfter = other.notAfter; this.notBefore = other.notBefore; } public ProxyUserToken deepCopy() { return new ProxyUserToken(this); } @Override public void clear() { this.x509 = null; this.issuedBy = null; this.issuedTo = null; this.issuedFor = null; setNotAfterIsSet(false); this.notAfter = 0; setNotBeforeIsSet(false); this.notBefore = 0; } public X509Info getX509() { return this.x509; } public ProxyUserToken setX509(X509Info x509) { this.x509 = x509; return this; } public void unsetX509() { this.x509 = null; } /** Returns true if field x509 is set (has been assigned a value) and false otherwise */ public boolean isSetX509() { return this.x509 != null; } public void setX509IsSet(boolean value) { if (!value) { this.x509 = null; } } public String getIssuedBy() { return this.issuedBy; } public ProxyUserToken setIssuedBy(String issuedBy) { this.issuedBy = issuedBy; return this; } public void unsetIssuedBy() { this.issuedBy = null; } /** Returns true if field issuedBy is set (has been assigned a value) and false otherwise */ public boolean isSetIssuedBy() { return this.issuedBy != null; } public void setIssuedByIsSet(boolean value) { if (!value) { this.issuedBy = null; } } public String getIssuedTo() { return this.issuedTo; } public ProxyUserToken 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 ProxyUserToken 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 getNotAfter() { return this.notAfter; } public ProxyUserToken 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 long getNotBefore() { return this.notBefore; } public ProxyUserToken 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 void setFieldValue(_Fields field, Object value) { switch (field) { case X509: if (value == null) { unsetX509(); } else { setX509((X509Info) value); } break; case ISSUED_BY: if (value == null) { unsetIssuedBy(); } else { setIssuedBy((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 NOT_AFTER: if (value == null) { unsetNotAfter(); } else { setNotAfter((Long) value); } break; case NOT_BEFORE: if (value == null) { unsetNotBefore(); } else { setNotBefore((Long) value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case X509: return getX509(); case ISSUED_BY: return getIssuedBy(); case ISSUED_TO: return getIssuedTo(); case ISSUED_FOR: return getIssuedFor(); case NOT_AFTER: return Long.valueOf(getNotAfter()); case NOT_BEFORE: return Long.valueOf(getNotBefore()); } 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 X509: return isSetX509(); case ISSUED_BY: return isSetIssuedBy(); case ISSUED_TO: return isSetIssuedTo(); case ISSUED_FOR: return isSetIssuedFor(); case NOT_AFTER: return isSetNotAfter(); case NOT_BEFORE: return isSetNotBefore(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof ProxyUserToken) return this.equals((ProxyUserToken) that); return false; } public boolean equals(ProxyUserToken that) { if (that == null) return false; boolean this_present_x509 = true && this.isSetX509(); boolean that_present_x509 = true && that.isSetX509(); if (this_present_x509 || that_present_x509) { if (!(this_present_x509 && that_present_x509)) return false; if (!this.x509.equals(that.x509)) return false; } boolean this_present_issuedBy = true && this.isSetIssuedBy(); boolean that_present_issuedBy = true && that.isSetIssuedBy(); if (this_present_issuedBy || that_present_issuedBy) { if (!(this_present_issuedBy && that_present_issuedBy)) return false; if (!this.issuedBy.equals(that.issuedBy)) 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_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_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; } return true; } @Override public int hashCode() { return 0; } @Override public int compareTo(ProxyUserToken other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetX509()).compareTo(other.isSetX509()); if (lastComparison != 0) { return lastComparison; } if (isSetX509()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.x509, other.x509); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetIssuedBy()).compareTo(other.isSetIssuedBy()); if (lastComparison != 0) { return lastComparison; } if (isSetIssuedBy()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuedBy, other.issuedBy); 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(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(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; } } 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("ProxyUserToken("); boolean first = true; sb.append("x509:"); if (this.x509 == null) { sb.append("null"); } else { sb.append(this.x509); } first = false; if (!first) sb.append(", "); sb.append("issuedBy:"); if (this.issuedBy == null) { sb.append("null"); } else { sb.append(this.issuedBy); } 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 (!first) sb.append(", "); sb.append("notAfter:"); sb.append(this.notAfter); first = false; if (isSetNotBefore()) { if (!first) sb.append(", "); sb.append("notBefore:"); sb.append(this.notBefore); first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (issuedBy == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'issuedBy' 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. // check for sub-struct validity if (x509 != null) { x509.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 ProxyUserTokenStandardSchemeFactory implements SchemeFactory { public ProxyUserTokenStandardScheme getScheme() { return new ProxyUserTokenStandardScheme(); } } private static class ProxyUserTokenStandardScheme extends StandardScheme<ProxyUserToken> { public void read(org.apache.thrift.protocol.TProtocol iprot, ProxyUserToken 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: // X509 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.x509 = new X509Info(); struct.x509.read(iprot); struct.setX509IsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 10: // ISSUED_BY if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.issuedBy = iprot.readString(); struct.setIssuedByIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 11: // 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 12: // 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 13: // 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 14: // 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; 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, ProxyUserToken struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.x509 != null) { oprot.writeFieldBegin(X509_FIELD_DESC); struct.x509.write(oprot); oprot.writeFieldEnd(); } if (struct.issuedBy != null) { oprot.writeFieldBegin(ISSUED_BY_FIELD_DESC); oprot.writeString(struct.issuedBy); 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(); } } oprot.writeFieldBegin(NOT_AFTER_FIELD_DESC); oprot.writeI64(struct.notAfter); oprot.writeFieldEnd(); if (struct.isSetNotBefore()) { oprot.writeFieldBegin(NOT_BEFORE_FIELD_DESC); oprot.writeI64(struct.notBefore); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class ProxyUserTokenTupleSchemeFactory implements SchemeFactory { public ProxyUserTokenTupleScheme getScheme() { return new ProxyUserTokenTupleScheme(); } } private static class ProxyUserTokenTupleScheme extends TupleScheme<ProxyUserToken> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, ProxyUserToken struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.issuedBy); oprot.writeString(struct.issuedTo); oprot.writeI64(struct.notAfter); BitSet optionals = new BitSet(); if (struct.isSetX509()) { optionals.set(0); } if (struct.isSetIssuedFor()) { optionals.set(1); } if (struct.isSetNotBefore()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetX509()) { struct.x509.write(oprot); } if (struct.isSetIssuedFor()) { oprot.writeString(struct.issuedFor); } if (struct.isSetNotBefore()) { oprot.writeI64(struct.notBefore); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, ProxyUserToken struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.issuedBy = iprot.readString(); struct.setIssuedByIsSet(true); struct.issuedTo = iprot.readString(); struct.setIssuedToIsSet(true); struct.notAfter = iprot.readI64(); struct.setNotAfterIsSet(true); BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.x509 = new X509Info(); struct.x509.read(iprot); struct.setX509IsSet(true); } if (incoming.get(1)) { struct.issuedFor = iprot.readString(); struct.setIssuedForIsSet(true); } if (incoming.get(2)) { struct.notBefore = iprot.readI64(); struct.setNotBeforeIsSet(true); } } } }