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.services.provenance.thrift; import org.apache.commons.lang3.builder.HashCodeBuilder; 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 DocumentInfo implements org.apache.thrift.TBase<DocumentInfo, DocumentInfo._Fields>, java.io.Serializable, Cloneable, Comparable<DocumentInfo> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( "DocumentInfo"); 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 DOCUMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField( "documentId", org.apache.thrift.protocol.TType.I64, (short) 2); private static final org.apache.thrift.protocol.TField APPLICATION_FIELD_DESC = new org.apache.thrift.protocol.TField( "application", org.apache.thrift.protocol.TType.STRING, (short) 3); private static final org.apache.thrift.protocol.TField TIME_STAMP_FIELD_DESC = new org.apache.thrift.protocol.TField( "timeStamp", org.apache.thrift.protocol.TType.STRUCT, (short) 4); private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField( "user", org.apache.thrift.protocol.TType.STRING, (short) 5); private static final org.apache.thrift.protocol.TField PARENTS_FIELD_DESC = new org.apache.thrift.protocol.TField( "parents", org.apache.thrift.protocol.TType.LIST, (short) 6); private static final org.apache.thrift.protocol.TField CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField( "children", org.apache.thrift.protocol.TType.LIST, (short) 7); private static final org.apache.thrift.protocol.TField AGE_OFF_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField( "ageOffInfo", org.apache.thrift.protocol.TType.LIST, (short) 8); private static final org.apache.thrift.protocol.TField AGED_FIELD_DESC = new org.apache.thrift.protocol.TField( "aged", org.apache.thrift.protocol.TType.BOOL, (short) 9); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new DocumentInfoStandardSchemeFactory()); schemes.put(TupleScheme.class, new DocumentInfoTupleSchemeFactory()); } public String uri; // required public long documentId; // required public String application; // required public ezbake.base.thrift.DateTime timeStamp; // required public String user; // required public List<Map<Long, String>> parents; // required public List<Map<Long, String>> children; // required public List<DocumentAgeOffInfo> ageOffInfo; // required public boolean aged; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { URI((short) 1, "uri"), DOCUMENT_ID((short) 2, "documentId"), APPLICATION((short) 3, "application"), TIME_STAMP((short) 4, "timeStamp"), USER((short) 5, "user"), PARENTS((short) 6, "parents"), CHILDREN((short) 7, "children"), AGE_OFF_INFO((short) 8, "ageOffInfo"), AGED((short) 9, "aged"); 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: // DOCUMENT_ID return DOCUMENT_ID; case 3: // APPLICATION return APPLICATION; case 4: // TIME_STAMP return TIME_STAMP; case 5: // USER return USER; case 6: // PARENTS return PARENTS; case 7: // CHILDREN return CHILDREN; case 8: // AGE_OFF_INFO return AGE_OFF_INFO; case 9: // AGED return AGED; 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 __DOCUMENTID_ISSET_ID = 0; private static final int __AGED_ISSET_ID = 1; private byte __isset_bitfield = 0; 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.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.DOCUMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("documentId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.APPLICATION, new org.apache.thrift.meta_data.FieldMetaData("application", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.TIME_STAMP, new org.apache.thrift.meta_data.FieldMetaData("timeStamp", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ezbake.base.thrift.DateTime.class))); tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.PARENTS, new org.apache.thrift.meta_data.FieldMetaData("parents", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 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.I64), new org.apache.thrift.meta_data.FieldValueMetaData( org.apache.thrift.protocol.TType.STRING))))); tmpMap.put(_Fields.CHILDREN, new org.apache.thrift.meta_data.FieldMetaData("children", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 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.I64), new org.apache.thrift.meta_data.FieldValueMetaData( org.apache.thrift.protocol.TType.STRING))))); tmpMap.put(_Fields.AGE_OFF_INFO, new org.apache.thrift.meta_data.FieldMetaData("ageOffInfo", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DocumentAgeOffInfo.class)))); tmpMap.put(_Fields.AGED, new org.apache.thrift.meta_data.FieldMetaData("aged", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DocumentInfo.class, metaDataMap); } public DocumentInfo() { } public DocumentInfo(String uri, long documentId, String application, ezbake.base.thrift.DateTime timeStamp, String user, List<Map<Long, String>> parents, List<Map<Long, String>> children, List<DocumentAgeOffInfo> ageOffInfo, boolean aged) { this(); this.uri = uri; this.documentId = documentId; setDocumentIdIsSet(true); this.application = application; this.timeStamp = timeStamp; this.user = user; this.parents = parents; this.children = children; this.ageOffInfo = ageOffInfo; this.aged = aged; setAgedIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public DocumentInfo(DocumentInfo other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetUri()) { this.uri = other.uri; } this.documentId = other.documentId; if (other.isSetApplication()) { this.application = other.application; } if (other.isSetTimeStamp()) { this.timeStamp = new ezbake.base.thrift.DateTime(other.timeStamp); } if (other.isSetUser()) { this.user = other.user; } if (other.isSetParents()) { List<Map<Long, String>> __this__parents = new ArrayList<Map<Long, String>>(other.parents.size()); for (Map<Long, String> other_element : other.parents) { Map<Long, String> __this__parents_copy = new HashMap<Long, String>(other_element); __this__parents.add(__this__parents_copy); } this.parents = __this__parents; } if (other.isSetChildren()) { List<Map<Long, String>> __this__children = new ArrayList<Map<Long, String>>(other.children.size()); for (Map<Long, String> other_element : other.children) { Map<Long, String> __this__children_copy = new HashMap<Long, String>(other_element); __this__children.add(__this__children_copy); } this.children = __this__children; } if (other.isSetAgeOffInfo()) { List<DocumentAgeOffInfo> __this__ageOffInfo = new ArrayList<DocumentAgeOffInfo>( other.ageOffInfo.size()); for (DocumentAgeOffInfo other_element : other.ageOffInfo) { __this__ageOffInfo.add(new DocumentAgeOffInfo(other_element)); } this.ageOffInfo = __this__ageOffInfo; } this.aged = other.aged; } public DocumentInfo deepCopy() { return new DocumentInfo(this); } @Override public void clear() { this.uri = null; setDocumentIdIsSet(false); this.documentId = 0; this.application = null; this.timeStamp = null; this.user = null; this.parents = null; this.children = null; this.ageOffInfo = null; setAgedIsSet(false); this.aged = false; } public String getUri() { return this.uri; } public DocumentInfo 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 long getDocumentId() { return this.documentId; } public DocumentInfo setDocumentId(long documentId) { this.documentId = documentId; setDocumentIdIsSet(true); return this; } public void unsetDocumentId() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DOCUMENTID_ISSET_ID); } /** Returns true if field documentId is set (has been assigned a value) and false otherwise */ public boolean isSetDocumentId() { return EncodingUtils.testBit(__isset_bitfield, __DOCUMENTID_ISSET_ID); } public void setDocumentIdIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DOCUMENTID_ISSET_ID, value); } public String getApplication() { return this.application; } public DocumentInfo setApplication(String application) { this.application = application; return this; } public void unsetApplication() { this.application = null; } /** Returns true if field application is set (has been assigned a value) and false otherwise */ public boolean isSetApplication() { return this.application != null; } public void setApplicationIsSet(boolean value) { if (!value) { this.application = null; } } public ezbake.base.thrift.DateTime getTimeStamp() { return this.timeStamp; } public DocumentInfo setTimeStamp(ezbake.base.thrift.DateTime timeStamp) { this.timeStamp = timeStamp; return this; } public void unsetTimeStamp() { this.timeStamp = null; } /** Returns true if field timeStamp is set (has been assigned a value) and false otherwise */ public boolean isSetTimeStamp() { return this.timeStamp != null; } public void setTimeStampIsSet(boolean value) { if (!value) { this.timeStamp = null; } } public String getUser() { return this.user; } public DocumentInfo setUser(String user) { this.user = user; return this; } public void unsetUser() { this.user = null; } /** Returns true if field user is set (has been assigned a value) and false otherwise */ public boolean isSetUser() { return this.user != null; } public void setUserIsSet(boolean value) { if (!value) { this.user = null; } } public int getParentsSize() { return (this.parents == null) ? 0 : this.parents.size(); } public java.util.Iterator<Map<Long, String>> getParentsIterator() { return (this.parents == null) ? null : this.parents.iterator(); } public void addToParents(Map<Long, String> elem) { if (this.parents == null) { this.parents = new ArrayList<Map<Long, String>>(); } this.parents.add(elem); } public List<Map<Long, String>> getParents() { return this.parents; } public DocumentInfo setParents(List<Map<Long, String>> parents) { this.parents = parents; return this; } public void unsetParents() { this.parents = null; } /** Returns true if field parents is set (has been assigned a value) and false otherwise */ public boolean isSetParents() { return this.parents != null; } public void setParentsIsSet(boolean value) { if (!value) { this.parents = null; } } public int getChildrenSize() { return (this.children == null) ? 0 : this.children.size(); } public java.util.Iterator<Map<Long, String>> getChildrenIterator() { return (this.children == null) ? null : this.children.iterator(); } public void addToChildren(Map<Long, String> elem) { if (this.children == null) { this.children = new ArrayList<Map<Long, String>>(); } this.children.add(elem); } public List<Map<Long, String>> getChildren() { return this.children; } public DocumentInfo setChildren(List<Map<Long, String>> children) { this.children = children; return this; } public void unsetChildren() { this.children = null; } /** Returns true if field children is set (has been assigned a value) and false otherwise */ public boolean isSetChildren() { return this.children != null; } public void setChildrenIsSet(boolean value) { if (!value) { this.children = null; } } public int getAgeOffInfoSize() { return (this.ageOffInfo == null) ? 0 : this.ageOffInfo.size(); } public java.util.Iterator<DocumentAgeOffInfo> getAgeOffInfoIterator() { return (this.ageOffInfo == null) ? null : this.ageOffInfo.iterator(); } public void addToAgeOffInfo(DocumentAgeOffInfo elem) { if (this.ageOffInfo == null) { this.ageOffInfo = new ArrayList<DocumentAgeOffInfo>(); } this.ageOffInfo.add(elem); } public List<DocumentAgeOffInfo> getAgeOffInfo() { return this.ageOffInfo; } public DocumentInfo setAgeOffInfo(List<DocumentAgeOffInfo> ageOffInfo) { this.ageOffInfo = ageOffInfo; return this; } public void unsetAgeOffInfo() { this.ageOffInfo = null; } /** Returns true if field ageOffInfo is set (has been assigned a value) and false otherwise */ public boolean isSetAgeOffInfo() { return this.ageOffInfo != null; } public void setAgeOffInfoIsSet(boolean value) { if (!value) { this.ageOffInfo = null; } } public boolean isAged() { return this.aged; } public DocumentInfo setAged(boolean aged) { this.aged = aged; setAgedIsSet(true); return this; } public void unsetAged() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGED_ISSET_ID); } /** Returns true if field aged is set (has been assigned a value) and false otherwise */ public boolean isSetAged() { return EncodingUtils.testBit(__isset_bitfield, __AGED_ISSET_ID); } public void setAgedIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGED_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case URI: if (value == null) { unsetUri(); } else { setUri((String) value); } break; case DOCUMENT_ID: if (value == null) { unsetDocumentId(); } else { setDocumentId((Long) value); } break; case APPLICATION: if (value == null) { unsetApplication(); } else { setApplication((String) value); } break; case TIME_STAMP: if (value == null) { unsetTimeStamp(); } else { setTimeStamp((ezbake.base.thrift.DateTime) value); } break; case USER: if (value == null) { unsetUser(); } else { setUser((String) value); } break; case PARENTS: if (value == null) { unsetParents(); } else { setParents((List<Map<Long, String>>) value); } break; case CHILDREN: if (value == null) { unsetChildren(); } else { setChildren((List<Map<Long, String>>) value); } break; case AGE_OFF_INFO: if (value == null) { unsetAgeOffInfo(); } else { setAgeOffInfo((List<DocumentAgeOffInfo>) value); } break; case AGED: if (value == null) { unsetAged(); } else { setAged((Boolean) value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case URI: return getUri(); case DOCUMENT_ID: return Long.valueOf(getDocumentId()); case APPLICATION: return getApplication(); case TIME_STAMP: return getTimeStamp(); case USER: return getUser(); case PARENTS: return getParents(); case CHILDREN: return getChildren(); case AGE_OFF_INFO: return getAgeOffInfo(); case AGED: return Boolean.valueOf(isAged()); } 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 DOCUMENT_ID: return isSetDocumentId(); case APPLICATION: return isSetApplication(); case TIME_STAMP: return isSetTimeStamp(); case USER: return isSetUser(); case PARENTS: return isSetParents(); case CHILDREN: return isSetChildren(); case AGE_OFF_INFO: return isSetAgeOffInfo(); case AGED: return isSetAged(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof DocumentInfo) return this.equals((DocumentInfo) that); return false; } public boolean equals(DocumentInfo 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_documentId = true; boolean that_present_documentId = true; if (this_present_documentId || that_present_documentId) { if (!(this_present_documentId && that_present_documentId)) return false; if (this.documentId != that.documentId) return false; } boolean this_present_application = true && this.isSetApplication(); boolean that_present_application = true && that.isSetApplication(); if (this_present_application || that_present_application) { if (!(this_present_application && that_present_application)) return false; if (!this.application.equals(that.application)) return false; } boolean this_present_timeStamp = true && this.isSetTimeStamp(); boolean that_present_timeStamp = true && that.isSetTimeStamp(); if (this_present_timeStamp || that_present_timeStamp) { if (!(this_present_timeStamp && that_present_timeStamp)) return false; if (!this.timeStamp.equals(that.timeStamp)) return false; } boolean this_present_user = true && this.isSetUser(); boolean that_present_user = true && that.isSetUser(); if (this_present_user || that_present_user) { if (!(this_present_user && that_present_user)) return false; if (!this.user.equals(that.user)) return false; } boolean this_present_parents = true && this.isSetParents(); boolean that_present_parents = true && that.isSetParents(); if (this_present_parents || that_present_parents) { if (!(this_present_parents && that_present_parents)) return false; if (!this.parents.equals(that.parents)) return false; } boolean this_present_children = true && this.isSetChildren(); boolean that_present_children = true && that.isSetChildren(); if (this_present_children || that_present_children) { if (!(this_present_children && that_present_children)) return false; if (!this.children.equals(that.children)) return false; } boolean this_present_ageOffInfo = true && this.isSetAgeOffInfo(); boolean that_present_ageOffInfo = true && that.isSetAgeOffInfo(); if (this_present_ageOffInfo || that_present_ageOffInfo) { if (!(this_present_ageOffInfo && that_present_ageOffInfo)) return false; if (!this.ageOffInfo.equals(that.ageOffInfo)) return false; } boolean this_present_aged = true; boolean that_present_aged = true; if (this_present_aged || that_present_aged) { if (!(this_present_aged && that_present_aged)) return false; if (this.aged != that.aged) return false; } return true; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_uri = true && (isSetUri()); builder.append(present_uri); if (present_uri) builder.append(uri); boolean present_documentId = true; builder.append(present_documentId); if (present_documentId) builder.append(documentId); boolean present_application = true && (isSetApplication()); builder.append(present_application); if (present_application) builder.append(application); boolean present_timeStamp = true && (isSetTimeStamp()); builder.append(present_timeStamp); if (present_timeStamp) builder.append(timeStamp); boolean present_user = true && (isSetUser()); builder.append(present_user); if (present_user) builder.append(user); boolean present_parents = true && (isSetParents()); builder.append(present_parents); if (present_parents) builder.append(parents); boolean present_children = true && (isSetChildren()); builder.append(present_children); if (present_children) builder.append(children); boolean present_ageOffInfo = true && (isSetAgeOffInfo()); builder.append(present_ageOffInfo); if (present_ageOffInfo) builder.append(ageOffInfo); boolean present_aged = true; builder.append(present_aged); if (present_aged) builder.append(aged); return builder.toHashCode(); } @Override public int compareTo(DocumentInfo 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(isSetDocumentId()).compareTo(other.isSetDocumentId()); if (lastComparison != 0) { return lastComparison; } if (isSetDocumentId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.documentId, other.documentId); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetApplication()).compareTo(other.isSetApplication()); if (lastComparison != 0) { return lastComparison; } if (isSetApplication()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.application, other.application); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetTimeStamp()).compareTo(other.isSetTimeStamp()); if (lastComparison != 0) { return lastComparison; } if (isSetTimeStamp()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeStamp, other.timeStamp); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); if (lastComparison != 0) { return lastComparison; } if (isSetUser()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetParents()).compareTo(other.isSetParents()); if (lastComparison != 0) { return lastComparison; } if (isSetParents()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parents, other.parents); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetChildren()).compareTo(other.isSetChildren()); if (lastComparison != 0) { return lastComparison; } if (isSetChildren()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.children, other.children); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetAgeOffInfo()).compareTo(other.isSetAgeOffInfo()); if (lastComparison != 0) { return lastComparison; } if (isSetAgeOffInfo()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ageOffInfo, other.ageOffInfo); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetAged()).compareTo(other.isSetAged()); if (lastComparison != 0) { return lastComparison; } if (isSetAged()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aged, other.aged); 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("DocumentInfo("); boolean first = true; sb.append("uri:"); if (this.uri == null) { sb.append("null"); } else { sb.append(this.uri); } first = false; if (!first) sb.append(", "); sb.append("documentId:"); sb.append(this.documentId); first = false; if (!first) sb.append(", "); sb.append("application:"); if (this.application == null) { sb.append("null"); } else { sb.append(this.application); } first = false; if (!first) sb.append(", "); sb.append("timeStamp:"); if (this.timeStamp == null) { sb.append("null"); } else { sb.append(this.timeStamp); } first = false; if (!first) sb.append(", "); sb.append("user:"); if (this.user == null) { sb.append("null"); } else { sb.append(this.user); } first = false; if (!first) sb.append(", "); sb.append("parents:"); if (this.parents == null) { sb.append("null"); } else { sb.append(this.parents); } first = false; if (!first) sb.append(", "); sb.append("children:"); if (this.children == null) { sb.append("null"); } else { sb.append(this.children); } first = false; if (!first) sb.append(", "); sb.append("ageOffInfo:"); if (this.ageOffInfo == null) { sb.append("null"); } else { sb.append(this.ageOffInfo); } first = false; if (!first) sb.append(", "); sb.append("aged:"); sb.append(this.aged); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (uri == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'uri' was not present! Struct: " + toString()); } // alas, we cannot check 'documentId' because it's a primitive and you chose the non-beans generator. if (application == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'application' was not present! Struct: " + toString()); } if (timeStamp == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'timeStamp' was not present! Struct: " + toString()); } if (user == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'user' was not present! Struct: " + toString()); } if (parents == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'parents' was not present! Struct: " + toString()); } if (children == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'children' was not present! Struct: " + toString()); } if (ageOffInfo == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'ageOffInfo' was not present! Struct: " + toString()); } // alas, we cannot check 'aged' because it's a primitive and you chose the non-beans generator. // check for sub-struct validity if (timeStamp != null) { timeStamp.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 DocumentInfoStandardSchemeFactory implements SchemeFactory { public DocumentInfoStandardScheme getScheme() { return new DocumentInfoStandardScheme(); } } private static class DocumentInfoStandardScheme extends StandardScheme<DocumentInfo> { public void read(org.apache.thrift.protocol.TProtocol iprot, DocumentInfo 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: // DOCUMENT_ID if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.documentId = iprot.readI64(); struct.setDocumentIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // APPLICATION if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.application = iprot.readString(); struct.setApplicationIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // TIME_STAMP if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.timeStamp = new ezbake.base.thrift.DateTime(); struct.timeStamp.read(iprot); struct.setTimeStampIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // USER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.user = iprot.readString(); struct.setUserIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // PARENTS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list32 = iprot.readListBegin(); struct.parents = new ArrayList<Map<Long, String>>(_list32.size); for (int _i33 = 0; _i33 < _list32.size; ++_i33) { Map<Long, String> _elem34; { org.apache.thrift.protocol.TMap _map35 = iprot.readMapBegin(); _elem34 = new HashMap<Long, String>(2 * _map35.size); for (int _i36 = 0; _i36 < _map35.size; ++_i36) { long _key37; String _val38; _key37 = iprot.readI64(); _val38 = iprot.readString(); _elem34.put(_key37, _val38); } iprot.readMapEnd(); } struct.parents.add(_elem34); } iprot.readListEnd(); } struct.setParentsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 7: // CHILDREN if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list39 = iprot.readListBegin(); struct.children = new ArrayList<Map<Long, String>>(_list39.size); for (int _i40 = 0; _i40 < _list39.size; ++_i40) { Map<Long, String> _elem41; { org.apache.thrift.protocol.TMap _map42 = iprot.readMapBegin(); _elem41 = new HashMap<Long, String>(2 * _map42.size); for (int _i43 = 0; _i43 < _map42.size; ++_i43) { long _key44; String _val45; _key44 = iprot.readI64(); _val45 = iprot.readString(); _elem41.put(_key44, _val45); } iprot.readMapEnd(); } struct.children.add(_elem41); } iprot.readListEnd(); } struct.setChildrenIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 8: // AGE_OFF_INFO if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list46 = iprot.readListBegin(); struct.ageOffInfo = new ArrayList<DocumentAgeOffInfo>(_list46.size); for (int _i47 = 0; _i47 < _list46.size; ++_i47) { DocumentAgeOffInfo _elem48; _elem48 = new DocumentAgeOffInfo(); _elem48.read(iprot); struct.ageOffInfo.add(_elem48); } iprot.readListEnd(); } struct.setAgeOffInfoIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 9: // AGED if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.aged = iprot.readBool(); struct.setAgedIsSet(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.isSetDocumentId()) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'documentId' was not found in serialized data! Struct: " + toString()); } if (!struct.isSetAged()) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'aged' was not found in serialized data! Struct: " + toString()); } struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, DocumentInfo 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(); } oprot.writeFieldBegin(DOCUMENT_ID_FIELD_DESC); oprot.writeI64(struct.documentId); oprot.writeFieldEnd(); if (struct.application != null) { oprot.writeFieldBegin(APPLICATION_FIELD_DESC); oprot.writeString(struct.application); oprot.writeFieldEnd(); } if (struct.timeStamp != null) { oprot.writeFieldBegin(TIME_STAMP_FIELD_DESC); struct.timeStamp.write(oprot); oprot.writeFieldEnd(); } if (struct.user != null) { oprot.writeFieldBegin(USER_FIELD_DESC); oprot.writeString(struct.user); oprot.writeFieldEnd(); } if (struct.parents != null) { oprot.writeFieldBegin(PARENTS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.MAP, struct.parents.size())); for (Map<Long, String> _iter49 : struct.parents) { { oprot.writeMapBegin( new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRING, _iter49.size())); for (Map.Entry<Long, String> _iter50 : _iter49.entrySet()) { oprot.writeI64(_iter50.getKey()); oprot.writeString(_iter50.getValue()); } oprot.writeMapEnd(); } } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.children != null) { oprot.writeFieldBegin(CHILDREN_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.MAP, struct.children.size())); for (Map<Long, String> _iter51 : struct.children) { { oprot.writeMapBegin( new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRING, _iter51.size())); for (Map.Entry<Long, String> _iter52 : _iter51.entrySet()) { oprot.writeI64(_iter52.getKey()); oprot.writeString(_iter52.getValue()); } oprot.writeMapEnd(); } } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.ageOffInfo != null) { oprot.writeFieldBegin(AGE_OFF_INFO_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, struct.ageOffInfo.size())); for (DocumentAgeOffInfo _iter53 : struct.ageOffInfo) { _iter53.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldBegin(AGED_FIELD_DESC); oprot.writeBool(struct.aged); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class DocumentInfoTupleSchemeFactory implements SchemeFactory { public DocumentInfoTupleScheme getScheme() { return new DocumentInfoTupleScheme(); } } private static class DocumentInfoTupleScheme extends TupleScheme<DocumentInfo> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, DocumentInfo struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.uri); oprot.writeI64(struct.documentId); oprot.writeString(struct.application); struct.timeStamp.write(oprot); oprot.writeString(struct.user); { oprot.writeI32(struct.parents.size()); for (Map<Long, String> _iter54 : struct.parents) { { oprot.writeI32(_iter54.size()); for (Map.Entry<Long, String> _iter55 : _iter54.entrySet()) { oprot.writeI64(_iter55.getKey()); oprot.writeString(_iter55.getValue()); } } } } { oprot.writeI32(struct.children.size()); for (Map<Long, String> _iter56 : struct.children) { { oprot.writeI32(_iter56.size()); for (Map.Entry<Long, String> _iter57 : _iter56.entrySet()) { oprot.writeI64(_iter57.getKey()); oprot.writeString(_iter57.getValue()); } } } } { oprot.writeI32(struct.ageOffInfo.size()); for (DocumentAgeOffInfo _iter58 : struct.ageOffInfo) { _iter58.write(oprot); } } oprot.writeBool(struct.aged); } @Override public void read(org.apache.thrift.protocol.TProtocol prot, DocumentInfo struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.uri = iprot.readString(); struct.setUriIsSet(true); struct.documentId = iprot.readI64(); struct.setDocumentIdIsSet(true); struct.application = iprot.readString(); struct.setApplicationIsSet(true); struct.timeStamp = new ezbake.base.thrift.DateTime(); struct.timeStamp.read(iprot); struct.setTimeStampIsSet(true); struct.user = iprot.readString(); struct.setUserIsSet(true); { org.apache.thrift.protocol.TList _list59 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.MAP, iprot.readI32()); struct.parents = new ArrayList<Map<Long, String>>(_list59.size); for (int _i60 = 0; _i60 < _list59.size; ++_i60) { Map<Long, String> _elem61; { org.apache.thrift.protocol.TMap _map62 = new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); _elem61 = new HashMap<Long, String>(2 * _map62.size); for (int _i63 = 0; _i63 < _map62.size; ++_i63) { long _key64; String _val65; _key64 = iprot.readI64(); _val65 = iprot.readString(); _elem61.put(_key64, _val65); } } struct.parents.add(_elem61); } } struct.setParentsIsSet(true); { org.apache.thrift.protocol.TList _list66 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.MAP, iprot.readI32()); struct.children = new ArrayList<Map<Long, String>>(_list66.size); for (int _i67 = 0; _i67 < _list66.size; ++_i67) { Map<Long, String> _elem68; { org.apache.thrift.protocol.TMap _map69 = new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); _elem68 = new HashMap<Long, String>(2 * _map69.size); for (int _i70 = 0; _i70 < _map69.size; ++_i70) { long _key71; String _val72; _key71 = iprot.readI64(); _val72 = iprot.readString(); _elem68.put(_key71, _val72); } } struct.children.add(_elem68); } } struct.setChildrenIsSet(true); { org.apache.thrift.protocol.TList _list73 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.ageOffInfo = new ArrayList<DocumentAgeOffInfo>(_list73.size); for (int _i74 = 0; _i74 < _list73.size; ++_i74) { DocumentAgeOffInfo _elem75; _elem75 = new DocumentAgeOffInfo(); _elem75.read(iprot); struct.ageOffInfo.add(_elem75); } } struct.setAgeOffInfoIsSet(true); struct.aged = iprot.readBool(); struct.setAgedIsSet(true); } } }