/** * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package alluxio.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 javax.annotation.Generated; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") public class MountTOptions implements org.apache.thrift.TBase<MountTOptions, MountTOptions._Fields>, java.io.Serializable, Cloneable, Comparable<MountTOptions> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("MountTOptions"); private static final org.apache.thrift.protocol.TField READ_ONLY_FIELD_DESC = new org.apache.thrift.protocol.TField("readOnly", org.apache.thrift.protocol.TType.BOOL, (short)1); private static final org.apache.thrift.protocol.TField PROPERTIES_FIELD_DESC = new org.apache.thrift.protocol.TField("properties", org.apache.thrift.protocol.TType.MAP, (short)2); private static final org.apache.thrift.protocol.TField SHARED_FIELD_DESC = new org.apache.thrift.protocol.TField("shared", org.apache.thrift.protocol.TType.BOOL, (short)3); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new MountTOptionsStandardSchemeFactory()); schemes.put(TupleScheme.class, new MountTOptionsTupleSchemeFactory()); } private boolean readOnly; // optional private Map<String,String> properties; // optional private boolean shared; // 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 { READ_ONLY((short)1, "readOnly"), PROPERTIES((short)2, "properties"), SHARED((short)3, "shared"); 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: // READ_ONLY return READ_ONLY; case 2: // PROPERTIES return PROPERTIES; case 3: // SHARED return SHARED; 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 __READONLY_ISSET_ID = 0; private static final int __SHARED_ISSET_ID = 1; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.READ_ONLY,_Fields.PROPERTIES,_Fields.SHARED}; 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.READ_ONLY, new org.apache.thrift.meta_data.FieldMetaData("readOnly", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.PROPERTIES, new org.apache.thrift.meta_data.FieldMetaData("properties", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.SHARED, new org.apache.thrift.meta_data.FieldMetaData("shared", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(MountTOptions.class, metaDataMap); } public MountTOptions() { } /** * Performs a deep copy on <i>other</i>. */ public MountTOptions(MountTOptions other) { __isset_bitfield = other.__isset_bitfield; this.readOnly = other.readOnly; if (other.isSetProperties()) { Map<String,String> __this__properties = new HashMap<String,String>(other.properties); this.properties = __this__properties; } this.shared = other.shared; } public MountTOptions deepCopy() { return new MountTOptions(this); } @Override public void clear() { setReadOnlyIsSet(false); this.readOnly = false; this.properties = null; setSharedIsSet(false); this.shared = false; } public boolean isReadOnly() { return this.readOnly; } public MountTOptions setReadOnly(boolean readOnly) { this.readOnly = readOnly; setReadOnlyIsSet(true); return this; } public void unsetReadOnly() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __READONLY_ISSET_ID); } /** Returns true if field readOnly is set (has been assigned a value) and false otherwise */ public boolean isSetReadOnly() { return EncodingUtils.testBit(__isset_bitfield, __READONLY_ISSET_ID); } public void setReadOnlyIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __READONLY_ISSET_ID, value); } public int getPropertiesSize() { return (this.properties == null) ? 0 : this.properties.size(); } public void putToProperties(String key, String val) { if (this.properties == null) { this.properties = new HashMap<String,String>(); } this.properties.put(key, val); } public Map<String,String> getProperties() { return this.properties; } public MountTOptions setProperties(Map<String,String> properties) { this.properties = properties; return this; } public void unsetProperties() { this.properties = null; } /** Returns true if field properties is set (has been assigned a value) and false otherwise */ public boolean isSetProperties() { return this.properties != null; } public void setPropertiesIsSet(boolean value) { if (!value) { this.properties = null; } } public boolean isShared() { return this.shared; } public MountTOptions setShared(boolean shared) { this.shared = shared; setSharedIsSet(true); return this; } public void unsetShared() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SHARED_ISSET_ID); } /** Returns true if field shared is set (has been assigned a value) and false otherwise */ public boolean isSetShared() { return EncodingUtils.testBit(__isset_bitfield, __SHARED_ISSET_ID); } public void setSharedIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SHARED_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case READ_ONLY: if (value == null) { unsetReadOnly(); } else { setReadOnly((Boolean)value); } break; case PROPERTIES: if (value == null) { unsetProperties(); } else { setProperties((Map<String,String>)value); } break; case SHARED: if (value == null) { unsetShared(); } else { setShared((Boolean)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case READ_ONLY: return isReadOnly(); case PROPERTIES: return getProperties(); case SHARED: return isShared(); } 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 READ_ONLY: return isSetReadOnly(); case PROPERTIES: return isSetProperties(); case SHARED: return isSetShared(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof MountTOptions) return this.equals((MountTOptions)that); return false; } public boolean equals(MountTOptions that) { if (that == null) return false; boolean this_present_readOnly = true && this.isSetReadOnly(); boolean that_present_readOnly = true && that.isSetReadOnly(); if (this_present_readOnly || that_present_readOnly) { if (!(this_present_readOnly && that_present_readOnly)) return false; if (this.readOnly != that.readOnly) return false; } boolean this_present_properties = true && this.isSetProperties(); boolean that_present_properties = true && that.isSetProperties(); if (this_present_properties || that_present_properties) { if (!(this_present_properties && that_present_properties)) return false; if (!this.properties.equals(that.properties)) return false; } boolean this_present_shared = true && this.isSetShared(); boolean that_present_shared = true && that.isSetShared(); if (this_present_shared || that_present_shared) { if (!(this_present_shared && that_present_shared)) return false; if (this.shared != that.shared) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_readOnly = true && (isSetReadOnly()); list.add(present_readOnly); if (present_readOnly) list.add(readOnly); boolean present_properties = true && (isSetProperties()); list.add(present_properties); if (present_properties) list.add(properties); boolean present_shared = true && (isSetShared()); list.add(present_shared); if (present_shared) list.add(shared); return list.hashCode(); } @Override public int compareTo(MountTOptions other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetReadOnly()).compareTo(other.isSetReadOnly()); if (lastComparison != 0) { return lastComparison; } if (isSetReadOnly()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.readOnly, other.readOnly); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetProperties()).compareTo(other.isSetProperties()); if (lastComparison != 0) { return lastComparison; } if (isSetProperties()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.properties, other.properties); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetShared()).compareTo(other.isSetShared()); if (lastComparison != 0) { return lastComparison; } if (isSetShared()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shared, other.shared); 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("MountTOptions("); boolean first = true; if (isSetReadOnly()) { sb.append("readOnly:"); sb.append(this.readOnly); first = false; } if (isSetProperties()) { if (!first) sb.append(", "); sb.append("properties:"); if (this.properties == null) { sb.append("null"); } else { sb.append(this.properties); } first = false; } if (isSetShared()) { if (!first) sb.append(", "); sb.append("shared:"); sb.append(this.shared); first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // 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 MountTOptionsStandardSchemeFactory implements SchemeFactory { public MountTOptionsStandardScheme getScheme() { return new MountTOptionsStandardScheme(); } } private static class MountTOptionsStandardScheme extends StandardScheme<MountTOptions> { public void read(org.apache.thrift.protocol.TProtocol iprot, MountTOptions 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: // READ_ONLY if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.readOnly = iprot.readBool(); struct.setReadOnlyIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // PROPERTIES if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map48 = iprot.readMapBegin(); struct.properties = new HashMap<String,String>(2*_map48.size); String _key49; String _val50; for (int _i51 = 0; _i51 < _map48.size; ++_i51) { _key49 = iprot.readString(); _val50 = iprot.readString(); struct.properties.put(_key49, _val50); } iprot.readMapEnd(); } struct.setPropertiesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // SHARED if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.shared = iprot.readBool(); struct.setSharedIsSet(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 struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, MountTOptions struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.isSetReadOnly()) { oprot.writeFieldBegin(READ_ONLY_FIELD_DESC); oprot.writeBool(struct.readOnly); oprot.writeFieldEnd(); } if (struct.properties != null) { if (struct.isSetProperties()) { oprot.writeFieldBegin(PROPERTIES_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.properties.size())); for (Map.Entry<String, String> _iter52 : struct.properties.entrySet()) { oprot.writeString(_iter52.getKey()); oprot.writeString(_iter52.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } } if (struct.isSetShared()) { oprot.writeFieldBegin(SHARED_FIELD_DESC); oprot.writeBool(struct.shared); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class MountTOptionsTupleSchemeFactory implements SchemeFactory { public MountTOptionsTupleScheme getScheme() { return new MountTOptionsTupleScheme(); } } private static class MountTOptionsTupleScheme extends TupleScheme<MountTOptions> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, MountTOptions struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetReadOnly()) { optionals.set(0); } if (struct.isSetProperties()) { optionals.set(1); } if (struct.isSetShared()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetReadOnly()) { oprot.writeBool(struct.readOnly); } if (struct.isSetProperties()) { { oprot.writeI32(struct.properties.size()); for (Map.Entry<String, String> _iter53 : struct.properties.entrySet()) { oprot.writeString(_iter53.getKey()); oprot.writeString(_iter53.getValue()); } } } if (struct.isSetShared()) { oprot.writeBool(struct.shared); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, MountTOptions struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.readOnly = iprot.readBool(); struct.setReadOnlyIsSet(true); } if (incoming.get(1)) { { org.apache.thrift.protocol.TMap _map54 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.properties = new HashMap<String,String>(2*_map54.size); String _key55; String _val56; for (int _i57 = 0; _i57 < _map54.size; ++_i57) { _key55 = iprot.readString(); _val56 = iprot.readString(); struct.properties.put(_key55, _val56); } } struct.setPropertiesIsSet(true); } if (incoming.get(2)) { struct.shared = iprot.readBool(); struct.setSharedIsSet(true); } } } }