/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import java.util.Collections; import java.util.BitSet; import java.util.Arrays; import com.facebook.thrift.*; import com.facebook.thrift.annotations.*; import com.facebook.thrift.async.*; import com.facebook.thrift.meta_data.*; import com.facebook.thrift.server.*; import com.facebook.thrift.transport.*; import com.facebook.thrift.protocol.*; @SuppressWarnings({ "unused", "serial" }) public class StructWithString implements TBase, java.io.Serializable, Cloneable, Comparable { private static final TStruct STRUCT_DESC = new TStruct("StructWithString"); private static final TField DEF_UNIQUE_STRING_REF_FIELD_DESC = new TField("def_unique_string_ref", TType.STRING, (short)1); private static final TField DEF_SHARED_STRING_REF_FIELD_DESC = new TField("def_shared_string_ref", TType.STRING, (short)2); private static final TField DEF_SHARED_STRING_CONST_REF_FIELD_DESC = new TField("def_shared_string_const_ref", TType.STRING, (short)3); private static final TField UNIQUE_STRING_REF_FIELD_DESC = new TField("unique_string_ref", TType.STRING, (short)4); private static final TField SHARED_STRING_REF_FIELD_DESC = new TField("shared_string_ref", TType.STRING, (short)5); public String def_unique_string_ref; public String def_shared_string_ref; public String def_shared_string_const_ref; public String unique_string_ref; public String shared_string_ref; public static final int DEF_UNIQUE_STRING_REF = 1; public static final int DEF_SHARED_STRING_REF = 2; public static final int DEF_SHARED_STRING_CONST_REF = 3; public static final int UNIQUE_STRING_REF = 4; public static final int SHARED_STRING_REF = 5; // isset id assignments public static final Map metaDataMap; static { Map tmpMetaDataMap = new HashMap(); tmpMetaDataMap.put(DEF_UNIQUE_STRING_REF, new FieldMetaData("def_unique_string_ref", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(DEF_SHARED_STRING_REF, new FieldMetaData("def_shared_string_ref", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(DEF_SHARED_STRING_CONST_REF, new FieldMetaData("def_shared_string_const_ref", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(UNIQUE_STRING_REF, new FieldMetaData("unique_string_ref", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(SHARED_STRING_REF, new FieldMetaData("shared_string_ref", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap); } static { FieldMetaData.addStructMetaDataMap(StructWithString.class, metaDataMap); } public StructWithString() { this.def_unique_string_ref = "..."; this.def_shared_string_ref = "..."; this.def_shared_string_const_ref = "..."; } public StructWithString( String def_unique_string_ref, String def_shared_string_ref, String def_shared_string_const_ref, String unique_string_ref, String shared_string_ref) { this(); this.def_unique_string_ref = def_unique_string_ref; this.def_shared_string_ref = def_shared_string_ref; this.def_shared_string_const_ref = def_shared_string_const_ref; this.unique_string_ref = unique_string_ref; this.shared_string_ref = shared_string_ref; } public static class Builder { private String def_unique_string_ref; private String def_shared_string_ref; private String def_shared_string_const_ref; private String unique_string_ref; private String shared_string_ref; public Builder() { } public Builder setDef_unique_string_ref(final String def_unique_string_ref) { this.def_unique_string_ref = def_unique_string_ref; return this; } public Builder setDef_shared_string_ref(final String def_shared_string_ref) { this.def_shared_string_ref = def_shared_string_ref; return this; } public Builder setDef_shared_string_const_ref(final String def_shared_string_const_ref) { this.def_shared_string_const_ref = def_shared_string_const_ref; return this; } public Builder setUnique_string_ref(final String unique_string_ref) { this.unique_string_ref = unique_string_ref; return this; } public Builder setShared_string_ref(final String shared_string_ref) { this.shared_string_ref = shared_string_ref; return this; } public StructWithString build() { StructWithString result = new StructWithString(); result.setDef_unique_string_ref(this.def_unique_string_ref); result.setDef_shared_string_ref(this.def_shared_string_ref); result.setDef_shared_string_const_ref(this.def_shared_string_const_ref); result.setUnique_string_ref(this.unique_string_ref); result.setShared_string_ref(this.shared_string_ref); return result; } } public static Builder builder() { return new Builder(); } /** * Performs a deep copy on other. */ public StructWithString(StructWithString other) { if (other.isSetDef_unique_string_ref()) { this.def_unique_string_ref = TBaseHelper.deepCopy(other.def_unique_string_ref); } if (other.isSetDef_shared_string_ref()) { this.def_shared_string_ref = TBaseHelper.deepCopy(other.def_shared_string_ref); } if (other.isSetDef_shared_string_const_ref()) { this.def_shared_string_const_ref = TBaseHelper.deepCopy(other.def_shared_string_const_ref); } if (other.isSetUnique_string_ref()) { this.unique_string_ref = TBaseHelper.deepCopy(other.unique_string_ref); } if (other.isSetShared_string_ref()) { this.shared_string_ref = TBaseHelper.deepCopy(other.shared_string_ref); } } public StructWithString deepCopy() { return new StructWithString(this); } public String getDef_unique_string_ref() { return this.def_unique_string_ref; } public StructWithString setDef_unique_string_ref(String def_unique_string_ref) { this.def_unique_string_ref = def_unique_string_ref; return this; } public void unsetDef_unique_string_ref() { this.def_unique_string_ref = null; } // Returns true if field def_unique_string_ref is set (has been assigned a value) and false otherwise public boolean isSetDef_unique_string_ref() { return this.def_unique_string_ref != null; } public void setDef_unique_string_refIsSet(boolean __value) { if (!__value) { this.def_unique_string_ref = null; } } public String getDef_shared_string_ref() { return this.def_shared_string_ref; } public StructWithString setDef_shared_string_ref(String def_shared_string_ref) { this.def_shared_string_ref = def_shared_string_ref; return this; } public void unsetDef_shared_string_ref() { this.def_shared_string_ref = null; } // Returns true if field def_shared_string_ref is set (has been assigned a value) and false otherwise public boolean isSetDef_shared_string_ref() { return this.def_shared_string_ref != null; } public void setDef_shared_string_refIsSet(boolean __value) { if (!__value) { this.def_shared_string_ref = null; } } public String getDef_shared_string_const_ref() { return this.def_shared_string_const_ref; } public StructWithString setDef_shared_string_const_ref(String def_shared_string_const_ref) { this.def_shared_string_const_ref = def_shared_string_const_ref; return this; } public void unsetDef_shared_string_const_ref() { this.def_shared_string_const_ref = null; } // Returns true if field def_shared_string_const_ref is set (has been assigned a value) and false otherwise public boolean isSetDef_shared_string_const_ref() { return this.def_shared_string_const_ref != null; } public void setDef_shared_string_const_refIsSet(boolean __value) { if (!__value) { this.def_shared_string_const_ref = null; } } public String getUnique_string_ref() { return this.unique_string_ref; } public StructWithString setUnique_string_ref(String unique_string_ref) { this.unique_string_ref = unique_string_ref; return this; } public void unsetUnique_string_ref() { this.unique_string_ref = null; } // Returns true if field unique_string_ref is set (has been assigned a value) and false otherwise public boolean isSetUnique_string_ref() { return this.unique_string_ref != null; } public void setUnique_string_refIsSet(boolean __value) { if (!__value) { this.unique_string_ref = null; } } public String getShared_string_ref() { return this.shared_string_ref; } public StructWithString setShared_string_ref(String shared_string_ref) { this.shared_string_ref = shared_string_ref; return this; } public void unsetShared_string_ref() { this.shared_string_ref = null; } // Returns true if field shared_string_ref is set (has been assigned a value) and false otherwise public boolean isSetShared_string_ref() { return this.shared_string_ref != null; } public void setShared_string_refIsSet(boolean __value) { if (!__value) { this.shared_string_ref = null; } } public void setFieldValue(int fieldID, Object __value) { switch (fieldID) { case DEF_UNIQUE_STRING_REF: if (__value == null) { unsetDef_unique_string_ref(); } else { setDef_unique_string_ref((String)__value); } break; case DEF_SHARED_STRING_REF: if (__value == null) { unsetDef_shared_string_ref(); } else { setDef_shared_string_ref((String)__value); } break; case DEF_SHARED_STRING_CONST_REF: if (__value == null) { unsetDef_shared_string_const_ref(); } else { setDef_shared_string_const_ref((String)__value); } break; case UNIQUE_STRING_REF: if (__value == null) { unsetUnique_string_ref(); } else { setUnique_string_ref((String)__value); } break; case SHARED_STRING_REF: if (__value == null) { unsetShared_string_ref(); } else { setShared_string_ref((String)__value); } break; default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } public Object getFieldValue(int fieldID) { switch (fieldID) { case DEF_UNIQUE_STRING_REF: return getDef_unique_string_ref(); case DEF_SHARED_STRING_REF: return getDef_shared_string_ref(); case DEF_SHARED_STRING_CONST_REF: return getDef_shared_string_const_ref(); case UNIQUE_STRING_REF: return getUnique_string_ref(); case SHARED_STRING_REF: return getShared_string_ref(); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } @Override public boolean equals(Object _that) { if (_that == null) return false; if (this == _that) return true; if (!(_that instanceof StructWithString)) return false; StructWithString that = (StructWithString)_that; if (!TBaseHelper.equalsNobinary(this.isSetDef_unique_string_ref(), that.isSetDef_unique_string_ref(), this.def_unique_string_ref, that.def_unique_string_ref)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetDef_shared_string_ref(), that.isSetDef_shared_string_ref(), this.def_shared_string_ref, that.def_shared_string_ref)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetDef_shared_string_const_ref(), that.isSetDef_shared_string_const_ref(), this.def_shared_string_const_ref, that.def_shared_string_const_ref)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetUnique_string_ref(), that.isSetUnique_string_ref(), this.unique_string_ref, that.unique_string_ref)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetShared_string_ref(), that.isSetShared_string_ref(), this.shared_string_ref, that.shared_string_ref)) { return false; } return true; } @Override public int hashCode() { return Arrays.deepHashCode(new Object[] {def_unique_string_ref, def_shared_string_ref, def_shared_string_const_ref, unique_string_ref, shared_string_ref}); } @Override public int compareTo(StructWithString other) { if (other == null) { // See java.lang.Comparable docs throw new NullPointerException(); } if (other == this) { return 0; } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetDef_unique_string_ref()).compareTo(other.isSetDef_unique_string_ref()); if (lastComparison != 0) { return lastComparison; } lastComparison = TBaseHelper.compareTo(def_unique_string_ref, other.def_unique_string_ref); if (lastComparison != 0) { return lastComparison; } lastComparison = Boolean.valueOf(isSetDef_shared_string_ref()).compareTo(other.isSetDef_shared_string_ref()); if (lastComparison != 0) { return lastComparison; } lastComparison = TBaseHelper.compareTo(def_shared_string_ref, other.def_shared_string_ref); if (lastComparison != 0) { return lastComparison; } lastComparison = Boolean.valueOf(isSetDef_shared_string_const_ref()).compareTo(other.isSetDef_shared_string_const_ref()); if (lastComparison != 0) { return lastComparison; } lastComparison = TBaseHelper.compareTo(def_shared_string_const_ref, other.def_shared_string_const_ref); if (lastComparison != 0) { return lastComparison; } lastComparison = Boolean.valueOf(isSetUnique_string_ref()).compareTo(other.isSetUnique_string_ref()); if (lastComparison != 0) { return lastComparison; } lastComparison = TBaseHelper.compareTo(unique_string_ref, other.unique_string_ref); if (lastComparison != 0) { return lastComparison; } lastComparison = Boolean.valueOf(isSetShared_string_ref()).compareTo(other.isSetShared_string_ref()); if (lastComparison != 0) { return lastComparison; } lastComparison = TBaseHelper.compareTo(shared_string_ref, other.shared_string_ref); if (lastComparison != 0) { return lastComparison; } return 0; } public void read(TProtocol iprot) throws TException { TField __field; iprot.readStructBegin(metaDataMap); while (true) { __field = iprot.readFieldBegin(); if (__field.type == TType.STOP) { break; } switch (__field.id) { case DEF_UNIQUE_STRING_REF: if (__field.type == TType.STRING) { this.def_unique_string_ref = iprot.readString(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case DEF_SHARED_STRING_REF: if (__field.type == TType.STRING) { this.def_shared_string_ref = iprot.readString(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case DEF_SHARED_STRING_CONST_REF: if (__field.type == TType.STRING) { this.def_shared_string_const_ref = iprot.readString(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case UNIQUE_STRING_REF: if (__field.type == TType.STRING) { this.unique_string_ref = iprot.readString(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case SHARED_STRING_REF: if (__field.type == TType.STRING) { this.shared_string_ref = iprot.readString(); } else { TProtocolUtil.skip(iprot, __field.type); } break; default: TProtocolUtil.skip(iprot, __field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.def_unique_string_ref != null) { oprot.writeFieldBegin(DEF_UNIQUE_STRING_REF_FIELD_DESC); oprot.writeString(this.def_unique_string_ref); oprot.writeFieldEnd(); } if (this.def_shared_string_ref != null) { oprot.writeFieldBegin(DEF_SHARED_STRING_REF_FIELD_DESC); oprot.writeString(this.def_shared_string_ref); oprot.writeFieldEnd(); } if (this.def_shared_string_const_ref != null) { oprot.writeFieldBegin(DEF_SHARED_STRING_CONST_REF_FIELD_DESC); oprot.writeString(this.def_shared_string_const_ref); oprot.writeFieldEnd(); } if (this.unique_string_ref != null) { oprot.writeFieldBegin(UNIQUE_STRING_REF_FIELD_DESC); oprot.writeString(this.unique_string_ref); oprot.writeFieldEnd(); } if (this.shared_string_ref != null) { oprot.writeFieldBegin(SHARED_STRING_REF_FIELD_DESC); oprot.writeString(this.shared_string_ref); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { return toString(1, true); } @Override public String toString(int indent, boolean prettyPrint) { String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : ""; String newLine = prettyPrint ? "\n" : ""; String space = prettyPrint ? " " : ""; StringBuilder sb = new StringBuilder("StructWithString"); sb.append(space); sb.append("("); sb.append(newLine); boolean first = true; sb.append(indentStr); sb.append("def_unique_string_ref"); sb.append(space); sb.append(":").append(space); if (this.getDef_unique_string_ref() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getDef_unique_string_ref(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("def_shared_string_ref"); sb.append(space); sb.append(":").append(space); if (this.getDef_shared_string_ref() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getDef_shared_string_ref(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("def_shared_string_const_ref"); sb.append(space); sb.append(":").append(space); if (this.getDef_shared_string_const_ref() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getDef_shared_string_const_ref(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("unique_string_ref"); sb.append(space); sb.append(":").append(space); if (this.getUnique_string_ref() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getUnique_string_ref(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("shared_string_ref"); sb.append(space); sb.append(":").append(space); if (this.getShared_string_ref() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getShared_string_ref(), indent + 1, prettyPrint)); } first = false; sb.append(newLine + TBaseHelper.reduceIndent(indentStr)); sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } }