com.xiaomi.infra.galaxy.emq.thrift.TimeSeriesData Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.emq.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.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"})
/**
* metrics time series data
*/
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-9-13")
public class TimeSeriesData implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("TimeSeriesData");
private static final libthrift091.protocol.TField METRIC_FIELD_DESC = new libthrift091.protocol.TField("metric", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField TAGS_FIELD_DESC = new libthrift091.protocol.TField("tags", libthrift091.protocol.TType.MAP, (short)2);
private static final libthrift091.protocol.TField DATA_FIELD_DESC = new libthrift091.protocol.TField("data", libthrift091.protocol.TType.MAP, (short)3);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TimeSeriesDataStandardSchemeFactory());
schemes.put(TupleScheme.class, new TimeSeriesDataTupleSchemeFactory());
}
/**
* metric name
*/
public String metric; // optional
/**
* tags
*/
public Map tags; // optional
/**
* data, {timestamp => value}
*/
public Map data; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
/**
* metric name
*/
METRIC((short)1, "metric"),
/**
* tags
*/
TAGS((short)2, "tags"),
/**
* data, {timestamp => value}
*/
DATA((short)3, "data");
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: // METRIC
return METRIC;
case 2: // TAGS
return TAGS;
case 3: // DATA
return DATA;
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 _Fields optionals[] = {_Fields.METRIC,_Fields.TAGS,_Fields.DATA};
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.METRIC, new libthrift091.meta_data.FieldMetaData("metric", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.TAGS, new libthrift091.meta_data.FieldMetaData("tags", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.MapMetaData(libthrift091.protocol.TType.MAP,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING),
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING))));
tmpMap.put(_Fields.DATA, new libthrift091.meta_data.FieldMetaData("data", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.MapMetaData(libthrift091.protocol.TType.MAP,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I64),
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.DOUBLE))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(TimeSeriesData.class, metaDataMap);
}
public TimeSeriesData() {
}
/**
* Performs a deep copy on other.
*/
public TimeSeriesData(TimeSeriesData other) {
if (other.isSetMetric()) {
this.metric = other.metric;
}
if (other.isSetTags()) {
Map __this__tags = new HashMap(other.tags);
this.tags = __this__tags;
}
if (other.isSetData()) {
Map __this__data = new HashMap(other.data);
this.data = __this__data;
}
}
public TimeSeriesData deepCopy() {
return new TimeSeriesData(this);
}
@Override
public void clear() {
this.metric = null;
this.tags = null;
this.data = null;
}
/**
* metric name
*/
public String getMetric() {
return this.metric;
}
/**
* metric name
*/
public TimeSeriesData setMetric(String metric) {
this.metric = metric;
return this;
}
public void unsetMetric() {
this.metric = null;
}
/** Returns true if field metric is set (has been assigned a value) and false otherwise */
public boolean isSetMetric() {
return this.metric != null;
}
public void setMetricIsSet(boolean value) {
if (!value) {
this.metric = null;
}
}
public int getTagsSize() {
return (this.tags == null) ? 0 : this.tags.size();
}
public void putToTags(String key, String val) {
if (this.tags == null) {
this.tags = new HashMap();
}
this.tags.put(key, val);
}
/**
* tags
*/
public Map getTags() {
return this.tags;
}
/**
* tags
*/
public TimeSeriesData setTags(Map tags) {
this.tags = tags;
return this;
}
public void unsetTags() {
this.tags = null;
}
/** Returns true if field tags is set (has been assigned a value) and false otherwise */
public boolean isSetTags() {
return this.tags != null;
}
public void setTagsIsSet(boolean value) {
if (!value) {
this.tags = null;
}
}
public int getDataSize() {
return (this.data == null) ? 0 : this.data.size();
}
public void putToData(long key, double val) {
if (this.data == null) {
this.data = new HashMap();
}
this.data.put(key, val);
}
/**
* data, {timestamp => value}
*/
public Map getData() {
return this.data;
}
/**
* data, {timestamp => value}
*/
public TimeSeriesData setData(Map data) {
this.data = data;
return this;
}
public void unsetData() {
this.data = null;
}
/** Returns true if field data is set (has been assigned a value) and false otherwise */
public boolean isSetData() {
return this.data != null;
}
public void setDataIsSet(boolean value) {
if (!value) {
this.data = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case METRIC:
if (value == null) {
unsetMetric();
} else {
setMetric((String)value);
}
break;
case TAGS:
if (value == null) {
unsetTags();
} else {
setTags((Map)value);
}
break;
case DATA:
if (value == null) {
unsetData();
} else {
setData((Map)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case METRIC:
return getMetric();
case TAGS:
return getTags();
case DATA:
return getData();
}
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 METRIC:
return isSetMetric();
case TAGS:
return isSetTags();
case DATA:
return isSetData();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TimeSeriesData)
return this.equals((TimeSeriesData)that);
return false;
}
public boolean equals(TimeSeriesData that) {
if (that == null)
return false;
boolean this_present_metric = true && this.isSetMetric();
boolean that_present_metric = true && that.isSetMetric();
if (this_present_metric || that_present_metric) {
if (!(this_present_metric && that_present_metric))
return false;
if (!this.metric.equals(that.metric))
return false;
}
boolean this_present_tags = true && this.isSetTags();
boolean that_present_tags = true && that.isSetTags();
if (this_present_tags || that_present_tags) {
if (!(this_present_tags && that_present_tags))
return false;
if (!this.tags.equals(that.tags))
return false;
}
boolean this_present_data = true && this.isSetData();
boolean that_present_data = true && that.isSetData();
if (this_present_data || that_present_data) {
if (!(this_present_data && that_present_data))
return false;
if (!this.data.equals(that.data))
return false;
}
return true;
}
@Override
public int hashCode() {
List