/** * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package serializers.thrift.media; 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)", date = "2016-12-05") public class Media implements org.apache.thrift.TBase<Media, Media._Fields>, java.io.Serializable, Cloneable, Comparable<Media> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Media"); private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("uri", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField TITLE_FIELD_DESC = new org.apache.thrift.protocol.TField("title", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField WIDTH_FIELD_DESC = new org.apache.thrift.protocol.TField("width", org.apache.thrift.protocol.TType.I32, (short)3); private static final org.apache.thrift.protocol.TField HEIGHT_FIELD_DESC = new org.apache.thrift.protocol.TField("height", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField FORMAT_FIELD_DESC = new org.apache.thrift.protocol.TField("format", org.apache.thrift.protocol.TType.STRING, (short)5); private static final org.apache.thrift.protocol.TField DURATION_FIELD_DESC = new org.apache.thrift.protocol.TField("duration", org.apache.thrift.protocol.TType.I64, (short)6); private static final org.apache.thrift.protocol.TField SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("size", org.apache.thrift.protocol.TType.I64, (short)7); private static final org.apache.thrift.protocol.TField BITRATE_FIELD_DESC = new org.apache.thrift.protocol.TField("bitrate", org.apache.thrift.protocol.TType.I32, (short)8); private static final org.apache.thrift.protocol.TField PERSON_FIELD_DESC = new org.apache.thrift.protocol.TField("person", org.apache.thrift.protocol.TType.LIST, (short)9); private static final org.apache.thrift.protocol.TField PLAYER_FIELD_DESC = new org.apache.thrift.protocol.TField("player", org.apache.thrift.protocol.TType.I32, (short)10); private static final org.apache.thrift.protocol.TField COPYRIGHT_FIELD_DESC = new org.apache.thrift.protocol.TField("copyright", org.apache.thrift.protocol.TType.STRING, (short)11); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new MediaStandardSchemeFactory()); schemes.put(TupleScheme.class, new MediaTupleSchemeFactory()); } public String uri; // required public String title; // optional public int width; // required public int height; // required public String format; // required public long duration; // required public long size; // required public int bitrate; // optional public List<String> person; // required /** * * @see Player */ public Player player; // required public String copyright; // 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 { URI((short)1, "uri"), TITLE((short)2, "title"), WIDTH((short)3, "width"), HEIGHT((short)4, "height"), FORMAT((short)5, "format"), DURATION((short)6, "duration"), SIZE((short)7, "size"), BITRATE((short)8, "bitrate"), PERSON((short)9, "person"), /** * * @see Player */ PLAYER((short)10, "player"), COPYRIGHT((short)11, "copyright"); 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: // URI return URI; case 2: // TITLE return TITLE; case 3: // WIDTH return WIDTH; case 4: // HEIGHT return HEIGHT; case 5: // FORMAT return FORMAT; case 6: // DURATION return DURATION; case 7: // SIZE return SIZE; case 8: // BITRATE return BITRATE; case 9: // PERSON return PERSON; case 10: // PLAYER return PLAYER; case 11: // COPYRIGHT return COPYRIGHT; 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 __WIDTH_ISSET_ID = 0; private static final int __HEIGHT_ISSET_ID = 1; private static final int __DURATION_ISSET_ID = 2; private static final int __SIZE_ISSET_ID = 3; private static final int __BITRATE_ISSET_ID = 4; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.TITLE,_Fields.BITRATE,_Fields.COPYRIGHT}; 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.URI, new org.apache.thrift.meta_data.FieldMetaData("uri", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.TITLE, new org.apache.thrift.meta_data.FieldMetaData("title", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.WIDTH, new org.apache.thrift.meta_data.FieldMetaData("width", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "int"))); tmpMap.put(_Fields.HEIGHT, new org.apache.thrift.meta_data.FieldMetaData("height", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "int"))); tmpMap.put(_Fields.FORMAT, new org.apache.thrift.meta_data.FieldMetaData("format", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.DURATION, new org.apache.thrift.meta_data.FieldMetaData("duration", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "long"))); tmpMap.put(_Fields.SIZE, new org.apache.thrift.meta_data.FieldMetaData("size", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "long"))); tmpMap.put(_Fields.BITRATE, new org.apache.thrift.meta_data.FieldMetaData("bitrate", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "int"))); tmpMap.put(_Fields.PERSON, new org.apache.thrift.meta_data.FieldMetaData("person", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.PLAYER, new org.apache.thrift.meta_data.FieldMetaData("player", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Player.class))); tmpMap.put(_Fields.COPYRIGHT, new org.apache.thrift.meta_data.FieldMetaData("copyright", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Media.class, metaDataMap); } public Media() { } public Media( String uri, int width, int height, String format, long duration, long size, List<String> person, Player player) { this(); this.uri = uri; this.width = width; setWidthIsSet(true); this.height = height; setHeightIsSet(true); this.format = format; this.duration = duration; setDurationIsSet(true); this.size = size; setSizeIsSet(true); this.person = person; this.player = player; } /** * Performs a deep copy on <i>other</i>. */ public Media(Media other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetUri()) { this.uri = other.uri; } if (other.isSetTitle()) { this.title = other.title; } this.width = other.width; this.height = other.height; if (other.isSetFormat()) { this.format = other.format; } this.duration = other.duration; this.size = other.size; this.bitrate = other.bitrate; if (other.isSetPerson()) { List<String> __this__person = new ArrayList<String>(other.person); this.person = __this__person; } if (other.isSetPlayer()) { this.player = other.player; } if (other.isSetCopyright()) { this.copyright = other.copyright; } } public Media deepCopy() { return new Media(this); } @Override public void clear() { this.uri = null; this.title = null; setWidthIsSet(false); this.width = 0; setHeightIsSet(false); this.height = 0; this.format = null; setDurationIsSet(false); this.duration = 0; setSizeIsSet(false); this.size = 0; setBitrateIsSet(false); this.bitrate = 0; this.person = null; this.player = null; this.copyright = null; } public String getUri() { return this.uri; } public Media setUri(String uri) { this.uri = uri; return this; } public void unsetUri() { this.uri = null; } /** Returns true if field uri is set (has been assigned a value) and false otherwise */ public boolean isSetUri() { return this.uri != null; } public void setUriIsSet(boolean value) { if (!value) { this.uri = null; } } public String getTitle() { return this.title; } public Media setTitle(String title) { this.title = title; return this; } public void unsetTitle() { this.title = null; } /** Returns true if field title is set (has been assigned a value) and false otherwise */ public boolean isSetTitle() { return this.title != null; } public void setTitleIsSet(boolean value) { if (!value) { this.title = null; } } public int getWidth() { return this.width; } public Media setWidth(int width) { this.width = width; setWidthIsSet(true); return this; } public void unsetWidth() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WIDTH_ISSET_ID); } /** Returns true if field width is set (has been assigned a value) and false otherwise */ public boolean isSetWidth() { return EncodingUtils.testBit(__isset_bitfield, __WIDTH_ISSET_ID); } public void setWidthIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WIDTH_ISSET_ID, value); } public int getHeight() { return this.height; } public Media setHeight(int height) { this.height = height; setHeightIsSet(true); return this; } public void unsetHeight() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HEIGHT_ISSET_ID); } /** Returns true if field height is set (has been assigned a value) and false otherwise */ public boolean isSetHeight() { return EncodingUtils.testBit(__isset_bitfield, __HEIGHT_ISSET_ID); } public void setHeightIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HEIGHT_ISSET_ID, value); } public String getFormat() { return this.format; } public Media setFormat(String format) { this.format = format; return this; } public void unsetFormat() { this.format = null; } /** Returns true if field format is set (has been assigned a value) and false otherwise */ public boolean isSetFormat() { return this.format != null; } public void setFormatIsSet(boolean value) { if (!value) { this.format = null; } } public long getDuration() { return this.duration; } public Media setDuration(long duration) { this.duration = duration; setDurationIsSet(true); return this; } public void unsetDuration() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DURATION_ISSET_ID); } /** Returns true if field duration is set (has been assigned a value) and false otherwise */ public boolean isSetDuration() { return EncodingUtils.testBit(__isset_bitfield, __DURATION_ISSET_ID); } public void setDurationIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DURATION_ISSET_ID, value); } public long getSize() { return this.size; } public Media setSize(long size) { this.size = size; setSizeIsSet(true); return this; } public void unsetSize() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SIZE_ISSET_ID); } /** Returns true if field size is set (has been assigned a value) and false otherwise */ public boolean isSetSize() { return EncodingUtils.testBit(__isset_bitfield, __SIZE_ISSET_ID); } public void setSizeIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SIZE_ISSET_ID, value); } public int getBitrate() { return this.bitrate; } public Media setBitrate(int bitrate) { this.bitrate = bitrate; setBitrateIsSet(true); return this; } public void unsetBitrate() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BITRATE_ISSET_ID); } /** Returns true if field bitrate is set (has been assigned a value) and false otherwise */ public boolean isSetBitrate() { return EncodingUtils.testBit(__isset_bitfield, __BITRATE_ISSET_ID); } public void setBitrateIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BITRATE_ISSET_ID, value); } public int getPersonSize() { return (this.person == null) ? 0 : this.person.size(); } public java.util.Iterator<String> getPersonIterator() { return (this.person == null) ? null : this.person.iterator(); } public void addToPerson(String elem) { if (this.person == null) { this.person = new ArrayList<String>(); } this.person.add(elem); } public List<String> getPerson() { return this.person; } public Media setPerson(List<String> person) { this.person = person; return this; } public void unsetPerson() { this.person = null; } /** Returns true if field person is set (has been assigned a value) and false otherwise */ public boolean isSetPerson() { return this.person != null; } public void setPersonIsSet(boolean value) { if (!value) { this.person = null; } } /** * * @see Player */ public Player getPlayer() { return this.player; } /** * * @see Player */ public Media setPlayer(Player player) { this.player = player; return this; } public void unsetPlayer() { this.player = null; } /** Returns true if field player is set (has been assigned a value) and false otherwise */ public boolean isSetPlayer() { return this.player != null; } public void setPlayerIsSet(boolean value) { if (!value) { this.player = null; } } public String getCopyright() { return this.copyright; } public Media setCopyright(String copyright) { this.copyright = copyright; return this; } public void unsetCopyright() { this.copyright = null; } /** Returns true if field copyright is set (has been assigned a value) and false otherwise */ public boolean isSetCopyright() { return this.copyright != null; } public void setCopyrightIsSet(boolean value) { if (!value) { this.copyright = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case URI: if (value == null) { unsetUri(); } else { setUri((String)value); } break; case TITLE: if (value == null) { unsetTitle(); } else { setTitle((String)value); } break; case WIDTH: if (value == null) { unsetWidth(); } else { setWidth((Integer)value); } break; case HEIGHT: if (value == null) { unsetHeight(); } else { setHeight((Integer)value); } break; case FORMAT: if (value == null) { unsetFormat(); } else { setFormat((String)value); } break; case DURATION: if (value == null) { unsetDuration(); } else { setDuration((Long)value); } break; case SIZE: if (value == null) { unsetSize(); } else { setSize((Long)value); } break; case BITRATE: if (value == null) { unsetBitrate(); } else { setBitrate((Integer)value); } break; case PERSON: if (value == null) { unsetPerson(); } else { setPerson((List<String>)value); } break; case PLAYER: if (value == null) { unsetPlayer(); } else { setPlayer((Player)value); } break; case COPYRIGHT: if (value == null) { unsetCopyright(); } else { setCopyright((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case URI: return getUri(); case TITLE: return getTitle(); case WIDTH: return getWidth(); case HEIGHT: return getHeight(); case FORMAT: return getFormat(); case DURATION: return getDuration(); case SIZE: return getSize(); case BITRATE: return getBitrate(); case PERSON: return getPerson(); case PLAYER: return getPlayer(); case COPYRIGHT: return getCopyright(); } 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 URI: return isSetUri(); case TITLE: return isSetTitle(); case WIDTH: return isSetWidth(); case HEIGHT: return isSetHeight(); case FORMAT: return isSetFormat(); case DURATION: return isSetDuration(); case SIZE: return isSetSize(); case BITRATE: return isSetBitrate(); case PERSON: return isSetPerson(); case PLAYER: return isSetPlayer(); case COPYRIGHT: return isSetCopyright(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Media) return this.equals((Media)that); return false; } public boolean equals(Media that) { if (that == null) return false; boolean this_present_uri = true && this.isSetUri(); boolean that_present_uri = true && that.isSetUri(); if (this_present_uri || that_present_uri) { if (!(this_present_uri && that_present_uri)) return false; if (!this.uri.equals(that.uri)) return false; } boolean this_present_title = true && this.isSetTitle(); boolean that_present_title = true && that.isSetTitle(); if (this_present_title || that_present_title) { if (!(this_present_title && that_present_title)) return false; if (!this.title.equals(that.title)) return false; } boolean this_present_width = true; boolean that_present_width = true; if (this_present_width || that_present_width) { if (!(this_present_width && that_present_width)) return false; if (this.width != that.width) return false; } boolean this_present_height = true; boolean that_present_height = true; if (this_present_height || that_present_height) { if (!(this_present_height && that_present_height)) return false; if (this.height != that.height) return false; } boolean this_present_format = true && this.isSetFormat(); boolean that_present_format = true && that.isSetFormat(); if (this_present_format || that_present_format) { if (!(this_present_format && that_present_format)) return false; if (!this.format.equals(that.format)) return false; } boolean this_present_duration = true; boolean that_present_duration = true; if (this_present_duration || that_present_duration) { if (!(this_present_duration && that_present_duration)) return false; if (this.duration != that.duration) return false; } boolean this_present_size = true; boolean that_present_size = true; if (this_present_size || that_present_size) { if (!(this_present_size && that_present_size)) return false; if (this.size != that.size) return false; } boolean this_present_bitrate = true && this.isSetBitrate(); boolean that_present_bitrate = true && that.isSetBitrate(); if (this_present_bitrate || that_present_bitrate) { if (!(this_present_bitrate && that_present_bitrate)) return false; if (this.bitrate != that.bitrate) return false; } boolean this_present_person = true && this.isSetPerson(); boolean that_present_person = true && that.isSetPerson(); if (this_present_person || that_present_person) { if (!(this_present_person && that_present_person)) return false; if (!this.person.equals(that.person)) return false; } boolean this_present_player = true && this.isSetPlayer(); boolean that_present_player = true && that.isSetPlayer(); if (this_present_player || that_present_player) { if (!(this_present_player && that_present_player)) return false; if (!this.player.equals(that.player)) return false; } boolean this_present_copyright = true && this.isSetCopyright(); boolean that_present_copyright = true && that.isSetCopyright(); if (this_present_copyright || that_present_copyright) { if (!(this_present_copyright && that_present_copyright)) return false; if (!this.copyright.equals(that.copyright)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_uri = true && (isSetUri()); list.add(present_uri); if (present_uri) list.add(uri); boolean present_title = true && (isSetTitle()); list.add(present_title); if (present_title) list.add(title); boolean present_width = true; list.add(present_width); if (present_width) list.add(width); boolean present_height = true; list.add(present_height); if (present_height) list.add(height); boolean present_format = true && (isSetFormat()); list.add(present_format); if (present_format) list.add(format); boolean present_duration = true; list.add(present_duration); if (present_duration) list.add(duration); boolean present_size = true; list.add(present_size); if (present_size) list.add(size); boolean present_bitrate = true && (isSetBitrate()); list.add(present_bitrate); if (present_bitrate) list.add(bitrate); boolean present_person = true && (isSetPerson()); list.add(present_person); if (present_person) list.add(person); boolean present_player = true && (isSetPlayer()); list.add(present_player); if (present_player) list.add(player.getValue()); boolean present_copyright = true && (isSetCopyright()); list.add(present_copyright); if (present_copyright) list.add(copyright); return list.hashCode(); } @Override public int compareTo(Media other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetUri()).compareTo(other.isSetUri()); if (lastComparison != 0) { return lastComparison; } if (isSetUri()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uri, other.uri); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetTitle()).compareTo(other.isSetTitle()); if (lastComparison != 0) { return lastComparison; } if (isSetTitle()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.title, other.title); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetWidth()).compareTo(other.isSetWidth()); if (lastComparison != 0) { return lastComparison; } if (isSetWidth()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.width, other.width); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetHeight()).compareTo(other.isSetHeight()); if (lastComparison != 0) { return lastComparison; } if (isSetHeight()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.height, other.height); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetFormat()).compareTo(other.isSetFormat()); if (lastComparison != 0) { return lastComparison; } if (isSetFormat()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.format, other.format); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetDuration()).compareTo(other.isSetDuration()); if (lastComparison != 0) { return lastComparison; } if (isSetDuration()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.duration, other.duration); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSize()).compareTo(other.isSetSize()); if (lastComparison != 0) { return lastComparison; } if (isSetSize()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.size, other.size); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetBitrate()).compareTo(other.isSetBitrate()); if (lastComparison != 0) { return lastComparison; } if (isSetBitrate()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bitrate, other.bitrate); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPerson()).compareTo(other.isSetPerson()); if (lastComparison != 0) { return lastComparison; } if (isSetPerson()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.person, other.person); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPlayer()).compareTo(other.isSetPlayer()); if (lastComparison != 0) { return lastComparison; } if (isSetPlayer()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.player, other.player); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetCopyright()).compareTo(other.isSetCopyright()); if (lastComparison != 0) { return lastComparison; } if (isSetCopyright()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.copyright, other.copyright); 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("Media("); boolean first = true; sb.append("uri:"); if (this.uri == null) { sb.append("null"); } else { sb.append(this.uri); } first = false; if (isSetTitle()) { if (!first) sb.append(", "); sb.append("title:"); if (this.title == null) { sb.append("null"); } else { sb.append(this.title); } first = false; } if (!first) sb.append(", "); sb.append("width:"); sb.append(this.width); first = false; if (!first) sb.append(", "); sb.append("height:"); sb.append(this.height); first = false; if (!first) sb.append(", "); sb.append("format:"); if (this.format == null) { sb.append("null"); } else { sb.append(this.format); } first = false; if (!first) sb.append(", "); sb.append("duration:"); sb.append(this.duration); first = false; if (!first) sb.append(", "); sb.append("size:"); sb.append(this.size); first = false; if (isSetBitrate()) { if (!first) sb.append(", "); sb.append("bitrate:"); sb.append(this.bitrate); first = false; } if (!first) sb.append(", "); sb.append("person:"); if (this.person == null) { sb.append("null"); } else { sb.append(this.person); } first = false; if (!first) sb.append(", "); sb.append("player:"); if (this.player == null) { sb.append("null"); } else { sb.append(this.player); } first = false; if (isSetCopyright()) { if (!first) sb.append(", "); sb.append("copyright:"); if (this.copyright == null) { sb.append("null"); } else { sb.append(this.copyright); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // alas, we cannot check 'width' because it's a primitive and you chose the non-beans generator. // alas, we cannot check 'height' because it's a primitive and you chose the non-beans generator. if (format == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'format' was not present! Struct: " + toString()); } // alas, we cannot check 'duration' because it's a primitive and you chose the non-beans generator. // alas, we cannot check 'size' because it's a primitive and you chose the non-beans generator. if (person == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'person' was not present! Struct: " + toString()); } if (player == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'player' 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 MediaStandardSchemeFactory implements SchemeFactory { public MediaStandardScheme getScheme() { return new MediaStandardScheme(); } } private static class MediaStandardScheme extends StandardScheme<Media> { public void read(org.apache.thrift.protocol.TProtocol iprot, Media 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: // URI if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.uri = iprot.readString(); struct.setUriIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // TITLE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.title = iprot.readString(); struct.setTitleIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // WIDTH if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.width = iprot.readI32(); struct.setWidthIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // HEIGHT if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.height = iprot.readI32(); struct.setHeightIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // FORMAT if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.format = iprot.readString(); struct.setFormatIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // DURATION if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.duration = iprot.readI64(); struct.setDurationIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // SIZE if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.size = iprot.readI64(); struct.setSizeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 8: // BITRATE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.bitrate = iprot.readI32(); struct.setBitrateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 9: // PERSON if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); struct.person = new ArrayList<String>(_list0.size); String _elem1; for (int _i2 = 0; _i2 < _list0.size; ++_i2) { _elem1 = iprot.readString(); struct.person.add(_elem1); } iprot.readListEnd(); } struct.setPersonIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 10: // PLAYER if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.player = serializers.thrift.media.Player.findByValue(iprot.readI32()); struct.setPlayerIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 11: // COPYRIGHT if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.copyright = iprot.readString(); struct.setCopyrightIsSet(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.isSetWidth()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'width' was not found in serialized data! Struct: " + toString()); } if (!struct.isSetHeight()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'height' was not found in serialized data! Struct: " + toString()); } if (!struct.isSetDuration()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'duration' was not found in serialized data! Struct: " + toString()); } if (!struct.isSetSize()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'size' was not found in serialized data! Struct: " + toString()); } struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, Media struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.uri != null) { oprot.writeFieldBegin(URI_FIELD_DESC); oprot.writeString(struct.uri); oprot.writeFieldEnd(); } if (struct.title != null) { if (struct.isSetTitle()) { oprot.writeFieldBegin(TITLE_FIELD_DESC); oprot.writeString(struct.title); oprot.writeFieldEnd(); } } oprot.writeFieldBegin(WIDTH_FIELD_DESC); oprot.writeI32(struct.width); oprot.writeFieldEnd(); oprot.writeFieldBegin(HEIGHT_FIELD_DESC); oprot.writeI32(struct.height); oprot.writeFieldEnd(); if (struct.format != null) { oprot.writeFieldBegin(FORMAT_FIELD_DESC); oprot.writeString(struct.format); oprot.writeFieldEnd(); } oprot.writeFieldBegin(DURATION_FIELD_DESC); oprot.writeI64(struct.duration); oprot.writeFieldEnd(); oprot.writeFieldBegin(SIZE_FIELD_DESC); oprot.writeI64(struct.size); oprot.writeFieldEnd(); if (struct.isSetBitrate()) { oprot.writeFieldBegin(BITRATE_FIELD_DESC); oprot.writeI32(struct.bitrate); oprot.writeFieldEnd(); } if (struct.person != null) { oprot.writeFieldBegin(PERSON_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.person.size())); for (String _iter3 : struct.person) { oprot.writeString(_iter3); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.player != null) { oprot.writeFieldBegin(PLAYER_FIELD_DESC); oprot.writeI32(struct.player.getValue()); oprot.writeFieldEnd(); } if (struct.copyright != null) { if (struct.isSetCopyright()) { oprot.writeFieldBegin(COPYRIGHT_FIELD_DESC); oprot.writeString(struct.copyright); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class MediaTupleSchemeFactory implements SchemeFactory { public MediaTupleScheme getScheme() { return new MediaTupleScheme(); } } private static class MediaTupleScheme extends TupleScheme<Media> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, Media struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI32(struct.width); oprot.writeI32(struct.height); oprot.writeString(struct.format); oprot.writeI64(struct.duration); oprot.writeI64(struct.size); { oprot.writeI32(struct.person.size()); for (String _iter4 : struct.person) { oprot.writeString(_iter4); } } oprot.writeI32(struct.player.getValue()); BitSet optionals = new BitSet(); if (struct.isSetUri()) { optionals.set(0); } if (struct.isSetTitle()) { optionals.set(1); } if (struct.isSetBitrate()) { optionals.set(2); } if (struct.isSetCopyright()) { optionals.set(3); } oprot.writeBitSet(optionals, 4); if (struct.isSetUri()) { oprot.writeString(struct.uri); } if (struct.isSetTitle()) { oprot.writeString(struct.title); } if (struct.isSetBitrate()) { oprot.writeI32(struct.bitrate); } if (struct.isSetCopyright()) { oprot.writeString(struct.copyright); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, Media struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.width = iprot.readI32(); struct.setWidthIsSet(true); struct.height = iprot.readI32(); struct.setHeightIsSet(true); struct.format = iprot.readString(); struct.setFormatIsSet(true); struct.duration = iprot.readI64(); struct.setDurationIsSet(true); struct.size = iprot.readI64(); struct.setSizeIsSet(true); { org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.person = new ArrayList<String>(_list5.size); String _elem6; for (int _i7 = 0; _i7 < _list5.size; ++_i7) { _elem6 = iprot.readString(); struct.person.add(_elem6); } } struct.setPersonIsSet(true); struct.player = serializers.thrift.media.Player.findByValue(iprot.readI32()); struct.setPlayerIsSet(true); BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { struct.uri = iprot.readString(); struct.setUriIsSet(true); } if (incoming.get(1)) { struct.title = iprot.readString(); struct.setTitleIsSet(true); } if (incoming.get(2)) { struct.bitrate = iprot.readI32(); struct.setBitrateIsSet(true); } if (incoming.get(3)) { struct.copyright = iprot.readString(); struct.setCopyrightIsSet(true); } } } }