com.rbkmoney.damsel.wb_list.CountInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wb-list-proto Show documentation
Show all versions of wb-list-proto Show documentation
Generates jar artifact containing compiled thrift classes based on generated thrift IDL files
/**
* Autogenerated by Thrift Compiler (1.0.0-dev)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.rbkmoney.damsel.wb_list;
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.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", "unused"})
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2020-07-09")
public class CountInfo implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CountInfo");
private static final org.apache.thrift.protocol.TField COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("count", org.apache.thrift.protocol.TType.I64, (short)1);
private static final org.apache.thrift.protocol.TField TIME_TO_LIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("time_to_live", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField START_COUNT_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("start_count_time", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final SchemeFactory STANDARD_SCHEME_FACTORY = new CountInfoStandardSchemeFactory();
private static final SchemeFactory TUPLE_SCHEME_FACTORY = new CountInfoTupleSchemeFactory();
public long count; // required
public String time_to_live; // required
public String start_count_time; // 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 {
COUNT((short)1, "count"),
TIME_TO_LIVE((short)2, "time_to_live"),
START_COUNT_TIME((short)3, "start_count_time");
private static final Map byName = new HashMap();
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: // COUNT
return COUNT;
case 2: // TIME_TO_LIVE
return TIME_TO_LIVE;
case 3: // START_COUNT_TIME
return START_COUNT_TIME;
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 __COUNT_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.START_COUNT_TIME};
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.COUNT, new org.apache.thrift.meta_data.FieldMetaData("count", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.TIME_TO_LIVE, new org.apache.thrift.meta_data.FieldMetaData("time_to_live", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.START_COUNT_TIME, new org.apache.thrift.meta_data.FieldMetaData("start_count_time", 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(CountInfo.class, metaDataMap);
}
public CountInfo() {
}
public CountInfo(
long count,
String time_to_live)
{
this();
this.count = count;
setCountIsSet(true);
this.time_to_live = time_to_live;
}
/**
* Performs a deep copy on other.
*/
public CountInfo(CountInfo other) {
__isset_bitfield = other.__isset_bitfield;
this.count = other.count;
if (other.isSetTimeToLive()) {
this.time_to_live = other.time_to_live;
}
if (other.isSetStartCountTime()) {
this.start_count_time = other.start_count_time;
}
}
public CountInfo deepCopy() {
return new CountInfo(this);
}
@Override
public void clear() {
setCountIsSet(false);
this.count = 0;
this.time_to_live = null;
this.start_count_time = null;
}
public long getCount() {
return this.count;
}
public CountInfo setCount(long count) {
this.count = count;
setCountIsSet(true);
return this;
}
public void unsetCount() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
return EncodingUtils.testBit(__isset_bitfield, __COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COUNT_ISSET_ID, value);
}
public String getTimeToLive() {
return this.time_to_live;
}
public CountInfo setTimeToLive(String time_to_live) {
this.time_to_live = time_to_live;
return this;
}
public void unsetTimeToLive() {
this.time_to_live = null;
}
/** Returns true if field time_to_live is set (has been assigned a value) and false otherwise */
public boolean isSetTimeToLive() {
return this.time_to_live != null;
}
public void setTimeToLiveIsSet(boolean value) {
if (!value) {
this.time_to_live = null;
}
}
public String getStartCountTime() {
return this.start_count_time;
}
public CountInfo setStartCountTime(String start_count_time) {
this.start_count_time = start_count_time;
return this;
}
public void unsetStartCountTime() {
this.start_count_time = null;
}
/** Returns true if field start_count_time is set (has been assigned a value) and false otherwise */
public boolean isSetStartCountTime() {
return this.start_count_time != null;
}
public void setStartCountTimeIsSet(boolean value) {
if (!value) {
this.start_count_time = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Long)value);
}
break;
case TIME_TO_LIVE:
if (value == null) {
unsetTimeToLive();
} else {
setTimeToLive((String)value);
}
break;
case START_COUNT_TIME:
if (value == null) {
unsetStartCountTime();
} else {
setStartCountTime((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COUNT:
return getCount();
case TIME_TO_LIVE:
return getTimeToLive();
case START_COUNT_TIME:
return getStartCountTime();
}
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 COUNT:
return isSetCount();
case TIME_TO_LIVE:
return isSetTimeToLive();
case START_COUNT_TIME:
return isSetStartCountTime();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CountInfo)
return this.equals((CountInfo)that);
return false;
}
public boolean equals(CountInfo that) {
if (that == null)
return false;
boolean this_present_count = true;
boolean that_present_count = true;
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}
boolean this_present_time_to_live = true && this.isSetTimeToLive();
boolean that_present_time_to_live = true && that.isSetTimeToLive();
if (this_present_time_to_live || that_present_time_to_live) {
if (!(this_present_time_to_live && that_present_time_to_live))
return false;
if (!this.time_to_live.equals(that.time_to_live))
return false;
}
boolean this_present_start_count_time = true && this.isSetStartCountTime();
boolean that_present_start_count_time = true && that.isSetStartCountTime();
if (this_present_start_count_time || that_present_start_count_time) {
if (!(this_present_start_count_time && that_present_start_count_time))
return false;
if (!this.start_count_time.equals(that.start_count_time))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(count);
hashCode = hashCode * 8191 + ((isSetTimeToLive()) ? 131071 : 524287);
if (isSetTimeToLive())
hashCode = hashCode * 8191 + time_to_live.hashCode();
hashCode = hashCode * 8191 + ((isSetStartCountTime()) ? 131071 : 524287);
if (isSetStartCountTime())
hashCode = hashCode * 8191 + start_count_time.hashCode();
return hashCode;
}
@Override
public int compareTo(CountInfo other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetCount()).compareTo(other.isSetCount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.count, other.count);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTimeToLive()).compareTo(other.isSetTimeToLive());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTimeToLive()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.time_to_live, other.time_to_live);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetStartCountTime()).compareTo(other.isSetStartCountTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStartCountTime()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start_count_time, other.start_count_time);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public _Fields[] getFields() {
return _Fields.values();
}
public Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
return metaDataMap;
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
scheme(iprot).read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CountInfo(");
boolean first = true;
sb.append("count:");
sb.append(this.count);
first = false;
if (!first) sb.append(", ");
sb.append("time_to_live:");
if (this.time_to_live == null) {
sb.append("null");
} else {
sb.append(this.time_to_live);
}
first = false;
if (isSetStartCountTime()) {
if (!first) sb.append(", ");
sb.append("start_count_time:");
if (this.start_count_time == null) {
sb.append("null");
} else {
sb.append(this.start_count_time);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// alas, we cannot check 'count' because it's a primitive and you chose the non-beans generator.
if (time_to_live == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'time_to_live' 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 CountInfoStandardSchemeFactory implements SchemeFactory {
public CountInfoStandardScheme getScheme() {
return new CountInfoStandardScheme();
}
}
private static class CountInfoStandardScheme extends StandardScheme {
public void read(org.apache.thrift.protocol.TProtocol iprot, CountInfo 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: // COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.count = iprot.readI64();
struct.setCountIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // TIME_TO_LIVE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.time_to_live = iprot.readString();
struct.setTimeToLiveIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // START_COUNT_TIME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.start_count_time = iprot.readString();
struct.setStartCountTimeIsSet(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.isSetCount()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'count' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CountInfo struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI64(struct.count);
oprot.writeFieldEnd();
if (struct.time_to_live != null) {
oprot.writeFieldBegin(TIME_TO_LIVE_FIELD_DESC);
oprot.writeString(struct.time_to_live);
oprot.writeFieldEnd();
}
if (struct.start_count_time != null) {
if (struct.isSetStartCountTime()) {
oprot.writeFieldBegin(START_COUNT_TIME_FIELD_DESC);
oprot.writeString(struct.start_count_time);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CountInfoTupleSchemeFactory implements SchemeFactory {
public CountInfoTupleScheme getScheme() {
return new CountInfoTupleScheme();
}
}
private static class CountInfoTupleScheme extends TupleScheme {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CountInfo struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeI64(struct.count);
oprot.writeString(struct.time_to_live);
BitSet optionals = new BitSet();
if (struct.isSetStartCountTime()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetStartCountTime()) {
oprot.writeString(struct.start_count_time);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CountInfo struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.count = iprot.readI64();
struct.setCountIsSet(true);
struct.time_to_live = iprot.readString();
struct.setTimeToLiveIsSet(true);
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.start_count_time = iprot.readString();
struct.setStartCountTimeIsSet(true);
}
}
}
private static S scheme(org.apache.thrift.protocol.TProtocol proto) {
return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}