/** * 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.metrics.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"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-12-30") public class MetricsService { /** * 指标类接口 */ public interface Iface extends com.xiaomi.infra.galaxy.metrics.thrift.BaseService.Iface { public void pushMetrics(List<Metric> metrics) throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException; public Map<Long,Double> queryMetric(QueryRequest request) throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException; public List<MetricKey> suggest(String metricPrefix) throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException; } public interface AsyncIface extends com.xiaomi.infra.galaxy.metrics.thrift.BaseService .AsyncIface { public void pushMetrics(List<Metric> metrics, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException; public void queryMetric(QueryRequest request, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException; public void suggest(String metricPrefix, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException; } public static class Client extends com.xiaomi.infra.galaxy.metrics.thrift.BaseService.Client implements Iface { public static class Factory implements libthrift091.TServiceClientFactory<Client> { public Factory() {} public Client getClient(libthrift091.protocol.TProtocol prot) { return new Client(prot); } public Client getClient(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) { return new Client(iprot, oprot); } } public Client(libthrift091.protocol.TProtocol prot) { super(prot, prot); } public Client(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) { super(iprot, oprot); } public void pushMetrics(List<Metric> metrics) throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { send_pushMetrics(metrics); recv_pushMetrics(); } public void send_pushMetrics(List<Metric> metrics) throws libthrift091.TException { pushMetrics_args args = new pushMetrics_args(); args.setMetrics(metrics); sendBase("pushMetrics", args); } public void recv_pushMetrics() throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { pushMetrics_result result = new pushMetrics_result(); receiveBase(result, "pushMetrics"); if (result.se != null) { throw result.se; } return; } public Map<Long,Double> queryMetric(QueryRequest request) throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { send_queryMetric(request); return recv_queryMetric(); } public void send_queryMetric(QueryRequest request) throws libthrift091.TException { queryMetric_args args = new queryMetric_args(); args.setRequest(request); sendBase("queryMetric", args); } public Map<Long,Double> recv_queryMetric() throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { queryMetric_result result = new queryMetric_result(); receiveBase(result, "queryMetric"); if (result.isSetSuccess()) { return result.success; } if (result.se != null) { throw result.se; } throw new libthrift091.TApplicationException(libthrift091.TApplicationException.MISSING_RESULT, "queryMetric failed: unknown result"); } public List<MetricKey> suggest(String metricPrefix) throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { send_suggest(metricPrefix); return recv_suggest(); } public void send_suggest(String metricPrefix) throws libthrift091.TException { suggest_args args = new suggest_args(); args.setMetricPrefix(metricPrefix); sendBase("suggest", args); } public List<MetricKey> recv_suggest() throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { suggest_result result = new suggest_result(); receiveBase(result, "suggest"); if (result.isSetSuccess()) { return result.success; } if (result.se != null) { throw result.se; } throw new libthrift091.TApplicationException(libthrift091.TApplicationException.MISSING_RESULT, "suggest failed: unknown result"); } } public static class AsyncClient extends com.xiaomi.infra.galaxy.metrics.thrift.BaseService.AsyncClient implements AsyncIface { public static class Factory implements libthrift091.async.TAsyncClientFactory<AsyncClient> { private libthrift091.async.TAsyncClientManager clientManager; private libthrift091.protocol.TProtocolFactory protocolFactory; public Factory(libthrift091.async.TAsyncClientManager clientManager, libthrift091.protocol.TProtocolFactory protocolFactory) { this.clientManager = clientManager; this.protocolFactory = protocolFactory; } public AsyncClient getAsyncClient(libthrift091.transport.TNonblockingTransport transport) { return new AsyncClient(protocolFactory, clientManager, transport); } } public AsyncClient(libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.async.TAsyncClientManager clientManager, libthrift091.transport.TNonblockingTransport transport) { super(protocolFactory, clientManager, transport); } public void pushMetrics(List<Metric> metrics, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException { checkReady(); pushMetrics_call method_call = new pushMetrics_call(metrics, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class pushMetrics_call extends libthrift091.async.TAsyncMethodCall { private List<Metric> metrics; public pushMetrics_call(List<Metric> metrics, libthrift091.async.AsyncMethodCallback resultHandler, libthrift091.async.TAsyncClient client, libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.transport.TNonblockingTransport transport) throws libthrift091.TException { super(client, protocolFactory, transport, resultHandler, false); this.metrics = metrics; } public void write_args(libthrift091.protocol.TProtocol prot) throws libthrift091.TException { prot.writeMessageBegin(new libthrift091.protocol.TMessage("pushMetrics", libthrift091.protocol.TMessageType.CALL, 0)); pushMetrics_args args = new pushMetrics_args(); args.setMetrics(metrics); args.write(prot); prot.writeMessageEnd(); } public void getResult() throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { if (getState() != libthrift091.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } libthrift091.transport.TMemoryInputTransport memoryTransport = new libthrift091.transport.TMemoryInputTransport(getFrameBuffer().array()); libthrift091.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); (new Client(prot)).recv_pushMetrics(); } } public void queryMetric(QueryRequest request, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException { checkReady(); queryMetric_call method_call = new queryMetric_call(request, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class queryMetric_call extends libthrift091.async.TAsyncMethodCall { private QueryRequest request; public queryMetric_call(QueryRequest request, libthrift091.async.AsyncMethodCallback resultHandler, libthrift091.async.TAsyncClient client, libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.transport.TNonblockingTransport transport) throws libthrift091.TException { super(client, protocolFactory, transport, resultHandler, false); this.request = request; } public void write_args(libthrift091.protocol.TProtocol prot) throws libthrift091.TException { prot.writeMessageBegin(new libthrift091.protocol.TMessage("queryMetric", libthrift091.protocol.TMessageType.CALL, 0)); queryMetric_args args = new queryMetric_args(); args.setRequest(request); args.write(prot); prot.writeMessageEnd(); } public Map<Long,Double> getResult() throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { if (getState() != libthrift091.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } libthrift091.transport.TMemoryInputTransport memoryTransport = new libthrift091.transport.TMemoryInputTransport(getFrameBuffer().array()); libthrift091.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_queryMetric(); } } public void suggest(String metricPrefix, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException { checkReady(); suggest_call method_call = new suggest_call(metricPrefix, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class suggest_call extends libthrift091.async.TAsyncMethodCall { private String metricPrefix; public suggest_call(String metricPrefix, libthrift091.async.AsyncMethodCallback resultHandler, libthrift091.async.TAsyncClient client, libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.transport.TNonblockingTransport transport) throws libthrift091.TException { super(client, protocolFactory, transport, resultHandler, false); this.metricPrefix = metricPrefix; } public void write_args(libthrift091.protocol.TProtocol prot) throws libthrift091.TException { prot.writeMessageBegin(new libthrift091.protocol.TMessage("suggest", libthrift091.protocol.TMessageType.CALL, 0)); suggest_args args = new suggest_args(); args.setMetricPrefix(metricPrefix); args.write(prot); prot.writeMessageEnd(); } public List<MetricKey> getResult() throws com.xiaomi.infra.galaxy.metrics.thrift.ServiceException, libthrift091.TException { if (getState() != libthrift091.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } libthrift091.transport.TMemoryInputTransport memoryTransport = new libthrift091.transport.TMemoryInputTransport(getFrameBuffer().array()); libthrift091.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_suggest(); } } } public static class Processor<I extends Iface> extends com.xiaomi.infra.galaxy.metrics.thrift.BaseService.Processor<I> implements libthrift091.TProcessor { private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); public Processor(I iface) { super(iface, getProcessMap(new HashMap<String, libthrift091.ProcessFunction<I, ? extends libthrift091.TBase>>())); } protected Processor(I iface, Map<String, libthrift091.ProcessFunction<I, ? extends libthrift091.TBase>> processMap) { super(iface, getProcessMap(processMap)); } private static <I extends Iface> Map<String, libthrift091.ProcessFunction<I, ? extends libthrift091.TBase>> getProcessMap(Map<String, libthrift091.ProcessFunction<I, ? extends libthrift091.TBase>> processMap) { processMap.put("pushMetrics", new pushMetrics()); processMap.put("queryMetric", new queryMetric()); processMap.put("suggest", new suggest()); return processMap; } public static class pushMetrics<I extends Iface> extends libthrift091.ProcessFunction<I, pushMetrics_args> { public pushMetrics() { super("pushMetrics"); } public pushMetrics_args getEmptyArgsInstance() { return new pushMetrics_args(); } protected boolean isOneway() { return false; } public pushMetrics_result getResult(I iface, pushMetrics_args args) throws libthrift091.TException { pushMetrics_result result = new pushMetrics_result(); try { iface.pushMetrics(args.metrics); } catch (com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { result.se = se; } return result; } } public static class queryMetric<I extends Iface> extends libthrift091.ProcessFunction<I, queryMetric_args> { public queryMetric() { super("queryMetric"); } public queryMetric_args getEmptyArgsInstance() { return new queryMetric_args(); } protected boolean isOneway() { return false; } public queryMetric_result getResult(I iface, queryMetric_args args) throws libthrift091.TException { queryMetric_result result = new queryMetric_result(); try { result.success = iface.queryMetric(args.request); } catch (com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { result.se = se; } return result; } } public static class suggest<I extends Iface> extends libthrift091.ProcessFunction<I, suggest_args> { public suggest() { super("suggest"); } public suggest_args getEmptyArgsInstance() { return new suggest_args(); } protected boolean isOneway() { return false; } public suggest_result getResult(I iface, suggest_args args) throws libthrift091.TException { suggest_result result = new suggest_result(); try { result.success = iface.suggest(args.metricPrefix); } catch (com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { result.se = se; } return result; } } } public static class AsyncProcessor<I extends AsyncIface> extends com.xiaomi.infra.galaxy.metrics.thrift.BaseService.AsyncProcessor<I> { private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); public AsyncProcessor(I iface) { super(iface, getProcessMap(new HashMap<String, libthrift091.AsyncProcessFunction<I, ? extends libthrift091.TBase, ?>>())); } protected AsyncProcessor(I iface, Map<String, libthrift091.AsyncProcessFunction<I, ? extends libthrift091.TBase, ?>> processMap) { super(iface, getProcessMap(processMap)); } private static <I extends AsyncIface> Map<String, libthrift091.AsyncProcessFunction<I, ? extends libthrift091.TBase,?>> getProcessMap(Map<String, libthrift091.AsyncProcessFunction<I, ? extends libthrift091.TBase, ?>> processMap) { processMap.put("pushMetrics", new pushMetrics()); processMap.put("queryMetric", new queryMetric()); processMap.put("suggest", new suggest()); return processMap; } public static class pushMetrics<I extends AsyncIface> extends libthrift091.AsyncProcessFunction<I, pushMetrics_args, Void> { public pushMetrics() { super("pushMetrics"); } public pushMetrics_args getEmptyArgsInstance() { return new pushMetrics_args(); } public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final libthrift091.AsyncProcessFunction fcall = this; return new AsyncMethodCallback<Void>() { public void onComplete(Void o) { pushMetrics_result result = new pushMetrics_result(); try { fcall.sendResponse(fb,result, libthrift091.protocol.TMessageType.REPLY,seqid); return; } catch (Exception e) { LOGGER.error("Exception writing to internal frame buffer", e); } fb.close(); } public void onError(Exception e) { byte msgType = libthrift091.protocol.TMessageType.REPLY; libthrift091.TBase msg; pushMetrics_result result = new pushMetrics_result(); if (e instanceof com.xiaomi.infra.galaxy.metrics.thrift.ServiceException) { result.se = (com.xiaomi.infra.galaxy.metrics.thrift.ServiceException) e; result.setSeIsSet(true); msg = result; } else { msgType = libthrift091.protocol.TMessageType.EXCEPTION; msg = (libthrift091.TBase)new libthrift091.TApplicationException(libthrift091.TApplicationException.INTERNAL_ERROR, e.getMessage()); } try { fcall.sendResponse(fb,msg,msgType,seqid); return; } catch (Exception ex) { LOGGER.error("Exception writing to internal frame buffer", ex); } fb.close(); } }; } protected boolean isOneway() { return false; } public void start(I iface, pushMetrics_args args, libthrift091.async.AsyncMethodCallback<Void> resultHandler) throws TException { iface.pushMetrics(args.metrics,resultHandler); } } public static class queryMetric<I extends AsyncIface> extends libthrift091.AsyncProcessFunction<I, queryMetric_args, Map<Long,Double>> { public queryMetric() { super("queryMetric"); } public queryMetric_args getEmptyArgsInstance() { return new queryMetric_args(); } public AsyncMethodCallback<Map<Long,Double>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final libthrift091.AsyncProcessFunction fcall = this; return new AsyncMethodCallback<Map<Long,Double>>() { public void onComplete(Map<Long,Double> o) { queryMetric_result result = new queryMetric_result(); result.success = o; try { fcall.sendResponse(fb,result, libthrift091.protocol.TMessageType.REPLY,seqid); return; } catch (Exception e) { LOGGER.error("Exception writing to internal frame buffer", e); } fb.close(); } public void onError(Exception e) { byte msgType = libthrift091.protocol.TMessageType.REPLY; libthrift091.TBase msg; queryMetric_result result = new queryMetric_result(); if (e instanceof com.xiaomi.infra.galaxy.metrics.thrift.ServiceException) { result.se = (com.xiaomi.infra.galaxy.metrics.thrift.ServiceException) e; result.setSeIsSet(true); msg = result; } else { msgType = libthrift091.protocol.TMessageType.EXCEPTION; msg = (libthrift091.TBase)new libthrift091.TApplicationException(libthrift091.TApplicationException.INTERNAL_ERROR, e.getMessage()); } try { fcall.sendResponse(fb,msg,msgType,seqid); return; } catch (Exception ex) { LOGGER.error("Exception writing to internal frame buffer", ex); } fb.close(); } }; } protected boolean isOneway() { return false; } public void start(I iface, queryMetric_args args, libthrift091.async.AsyncMethodCallback<Map<Long,Double>> resultHandler) throws TException { iface.queryMetric(args.request,resultHandler); } } public static class suggest<I extends AsyncIface> extends libthrift091.AsyncProcessFunction<I, suggest_args, List<MetricKey>> { public suggest() { super("suggest"); } public suggest_args getEmptyArgsInstance() { return new suggest_args(); } public AsyncMethodCallback<List<MetricKey>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final libthrift091.AsyncProcessFunction fcall = this; return new AsyncMethodCallback<List<MetricKey>>() { public void onComplete(List<MetricKey> o) { suggest_result result = new suggest_result(); result.success = o; try { fcall.sendResponse(fb,result, libthrift091.protocol.TMessageType.REPLY,seqid); return; } catch (Exception e) { LOGGER.error("Exception writing to internal frame buffer", e); } fb.close(); } public void onError(Exception e) { byte msgType = libthrift091.protocol.TMessageType.REPLY; libthrift091.TBase msg; suggest_result result = new suggest_result(); if (e instanceof com.xiaomi.infra.galaxy.metrics.thrift.ServiceException) { result.se = (com.xiaomi.infra.galaxy.metrics.thrift.ServiceException) e; result.setSeIsSet(true); msg = result; } else { msgType = libthrift091.protocol.TMessageType.EXCEPTION; msg = (libthrift091.TBase)new libthrift091.TApplicationException(libthrift091.TApplicationException.INTERNAL_ERROR, e.getMessage()); } try { fcall.sendResponse(fb,msg,msgType,seqid); return; } catch (Exception ex) { LOGGER.error("Exception writing to internal frame buffer", ex); } fb.close(); } }; } protected boolean isOneway() { return false; } public void start(I iface, suggest_args args, libthrift091.async.AsyncMethodCallback<List<MetricKey>> resultHandler) throws TException { iface.suggest(args.metricPrefix,resultHandler); } } } public static class pushMetrics_args implements libthrift091.TBase<pushMetrics_args, pushMetrics_args._Fields>, java.io.Serializable, Cloneable, Comparable<pushMetrics_args> { private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("pushMetrics_args"); private static final libthrift091.protocol.TField METRICS_FIELD_DESC = new libthrift091.protocol.TField("metrics", libthrift091.protocol.TType.LIST, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new pushMetrics_argsStandardSchemeFactory()); schemes.put(TupleScheme.class, new pushMetrics_argsTupleSchemeFactory()); } public List<Metric> metrics; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements libthrift091.TFieldIdEnum { METRICS((short)1, "metrics"); 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: // METRICS return METRICS; 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 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.METRICS, new libthrift091.meta_data.FieldMetaData("metrics", libthrift091.TFieldRequirementType.DEFAULT, new libthrift091.meta_data.ListMetaData(libthrift091.protocol.TType.LIST, new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, Metric.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(pushMetrics_args.class, metaDataMap); } public pushMetrics_args() { } public pushMetrics_args( List<Metric> metrics) { this(); this.metrics = metrics; } /** * Performs a deep copy on <i>other</i>. */ public pushMetrics_args(pushMetrics_args other) { if (other.isSetMetrics()) { List<Metric> __this__metrics = new ArrayList<Metric>(other.metrics.size()); for (Metric other_element : other.metrics) { __this__metrics.add(new Metric(other_element)); } this.metrics = __this__metrics; } } public pushMetrics_args deepCopy() { return new pushMetrics_args(this); } @Override public void clear() { this.metrics = null; } public int getMetricsSize() { return (this.metrics == null) ? 0 : this.metrics.size(); } public java.util.Iterator<Metric> getMetricsIterator() { return (this.metrics == null) ? null : this.metrics.iterator(); } public void addToMetrics(Metric elem) { if (this.metrics == null) { this.metrics = new ArrayList<Metric>(); } this.metrics.add(elem); } public List<Metric> getMetrics() { return this.metrics; } public pushMetrics_args setMetrics(List<Metric> metrics) { this.metrics = metrics; return this; } public void unsetMetrics() { this.metrics = null; } /** Returns true if field metrics is set (has been assigned a value) and false otherwise */ public boolean isSetMetrics() { return this.metrics != null; } public void setMetricsIsSet(boolean value) { if (!value) { this.metrics = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case METRICS: if (value == null) { unsetMetrics(); } else { setMetrics((List<Metric>)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case METRICS: return getMetrics(); } 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 METRICS: return isSetMetrics(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof pushMetrics_args) return this.equals((pushMetrics_args)that); return false; } public boolean equals(pushMetrics_args that) { if (that == null) return false; boolean this_present_metrics = true && this.isSetMetrics(); boolean that_present_metrics = true && that.isSetMetrics(); if (this_present_metrics || that_present_metrics) { if (!(this_present_metrics && that_present_metrics)) return false; if (!this.metrics.equals(that.metrics)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_metrics = true && (isSetMetrics()); list.add(present_metrics); if (present_metrics) list.add(metrics); return list.hashCode(); } @Override public int compareTo(pushMetrics_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetMetrics()).compareTo(other.isSetMetrics()); if (lastComparison != 0) { return lastComparison; } if (isSetMetrics()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.metrics, other.metrics); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("pushMetrics_args("); boolean first = true; sb.append("metrics:"); if (this.metrics == null) { sb.append("null"); } else { sb.append(this.metrics); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws libthrift091.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private static class pushMetrics_argsStandardSchemeFactory implements SchemeFactory { public pushMetrics_argsStandardScheme getScheme() { return new pushMetrics_argsStandardScheme(); } } private static class pushMetrics_argsStandardScheme extends StandardScheme<pushMetrics_args> { public void read(libthrift091.protocol.TProtocol iprot, pushMetrics_args struct) throws libthrift091.TException { libthrift091.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == libthrift091.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // METRICS if (schemeField.type == libthrift091.protocol.TType.LIST) { { libthrift091.protocol.TList _list10 = iprot.readListBegin(); struct.metrics = new ArrayList<Metric>(_list10.size); Metric _elem11; for (int _i12 = 0; _i12 < _list10.size; ++_i12) { _elem11 = new Metric(); _elem11.read(iprot); struct.metrics.add(_elem11); } iprot.readListEnd(); } struct.setMetricsIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: libthrift091.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 struct.validate(); } public void write(libthrift091.protocol.TProtocol oprot, pushMetrics_args struct) throws libthrift091.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.metrics != null) { oprot.writeFieldBegin(METRICS_FIELD_DESC); { oprot.writeListBegin(new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, struct.metrics.size())); for (Metric _iter13 : struct.metrics) { _iter13.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class pushMetrics_argsTupleSchemeFactory implements SchemeFactory { public pushMetrics_argsTupleScheme getScheme() { return new pushMetrics_argsTupleScheme(); } } private static class pushMetrics_argsTupleScheme extends TupleScheme<pushMetrics_args> { @Override public void write(libthrift091.protocol.TProtocol prot, pushMetrics_args struct) throws libthrift091.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetMetrics()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetMetrics()) { { oprot.writeI32(struct.metrics.size()); for (Metric _iter14 : struct.metrics) { _iter14.write(oprot); } } } } @Override public void read(libthrift091.protocol.TProtocol prot, pushMetrics_args struct) throws libthrift091.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { libthrift091.protocol.TList _list15 = new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, iprot.readI32()); struct.metrics = new ArrayList<Metric>(_list15.size); Metric _elem16; for (int _i17 = 0; _i17 < _list15.size; ++_i17) { _elem16 = new Metric(); _elem16.read(iprot); struct.metrics.add(_elem16); } } struct.setMetricsIsSet(true); } } } } public static class pushMetrics_result implements libthrift091.TBase<pushMetrics_result, pushMetrics_result._Fields>, java.io.Serializable, Cloneable, Comparable<pushMetrics_result> { private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("pushMetrics_result"); private static final libthrift091.protocol.TField SE_FIELD_DESC = new libthrift091.protocol.TField("se", libthrift091.protocol.TType.STRUCT, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new pushMetrics_resultStandardSchemeFactory()); schemes.put(TupleScheme.class, new pushMetrics_resultTupleSchemeFactory()); } public com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements libthrift091.TFieldIdEnum { SE((short)1, "se"); 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: // SE return SE; 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 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.SE, new libthrift091.meta_data.FieldMetaData("se", libthrift091.TFieldRequirementType.DEFAULT, new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(pushMetrics_result.class, metaDataMap); } public pushMetrics_result() { } public pushMetrics_result( com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { this(); this.se = se; } /** * Performs a deep copy on <i>other</i>. */ public pushMetrics_result(pushMetrics_result other) { if (other.isSetSe()) { this.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(other.se); } } public pushMetrics_result deepCopy() { return new pushMetrics_result(this); } @Override public void clear() { this.se = null; } public com.xiaomi.infra.galaxy.metrics.thrift.ServiceException getSe() { return this.se; } public pushMetrics_result setSe(com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { this.se = se; return this; } public void unsetSe() { this.se = null; } /** Returns true if field se is set (has been assigned a value) and false otherwise */ public boolean isSetSe() { return this.se != null; } public void setSeIsSet(boolean value) { if (!value) { this.se = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case SE: if (value == null) { unsetSe(); } else { setSe((com.xiaomi.infra.galaxy.metrics.thrift.ServiceException)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case SE: return getSe(); } 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 SE: return isSetSe(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof pushMetrics_result) return this.equals((pushMetrics_result)that); return false; } public boolean equals(pushMetrics_result that) { if (that == null) return false; boolean this_present_se = true && this.isSetSe(); boolean that_present_se = true && that.isSetSe(); if (this_present_se || that_present_se) { if (!(this_present_se && that_present_se)) return false; if (!this.se.equals(that.se)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_se = true && (isSetSe()); list.add(present_se); if (present_se) list.add(se); return list.hashCode(); } @Override public int compareTo(pushMetrics_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetSe()).compareTo(other.isSetSe()); if (lastComparison != 0) { return lastComparison; } if (isSetSe()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.se, other.se); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("pushMetrics_result("); boolean first = true; sb.append("se:"); if (this.se == null) { sb.append("null"); } else { sb.append(this.se); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws libthrift091.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private static class pushMetrics_resultStandardSchemeFactory implements SchemeFactory { public pushMetrics_resultStandardScheme getScheme() { return new pushMetrics_resultStandardScheme(); } } private static class pushMetrics_resultStandardScheme extends StandardScheme<pushMetrics_result> { public void read(libthrift091.protocol.TProtocol iprot, pushMetrics_result struct) throws libthrift091.TException { libthrift091.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == libthrift091.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // SE if (schemeField.type == libthrift091.protocol.TType.STRUCT) { struct.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(); struct.se.read(iprot); struct.setSeIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: libthrift091.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 struct.validate(); } public void write(libthrift091.protocol.TProtocol oprot, pushMetrics_result struct) throws libthrift091.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.se != null) { oprot.writeFieldBegin(SE_FIELD_DESC); struct.se.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class pushMetrics_resultTupleSchemeFactory implements SchemeFactory { public pushMetrics_resultTupleScheme getScheme() { return new pushMetrics_resultTupleScheme(); } } private static class pushMetrics_resultTupleScheme extends TupleScheme<pushMetrics_result> { @Override public void write(libthrift091.protocol.TProtocol prot, pushMetrics_result struct) throws libthrift091.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSe()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetSe()) { struct.se.write(oprot); } } @Override public void read(libthrift091.protocol.TProtocol prot, pushMetrics_result struct) throws libthrift091.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(); struct.se.read(iprot); struct.setSeIsSet(true); } } } } public static class queryMetric_args implements libthrift091.TBase<queryMetric_args, queryMetric_args._Fields>, java.io.Serializable, Cloneable, Comparable<queryMetric_args> { private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("queryMetric_args"); private static final libthrift091.protocol.TField REQUEST_FIELD_DESC = new libthrift091.protocol.TField("request", libthrift091.protocol.TType.STRUCT, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new queryMetric_argsStandardSchemeFactory()); schemes.put(TupleScheme.class, new queryMetric_argsTupleSchemeFactory()); } public QueryRequest request; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements libthrift091.TFieldIdEnum { REQUEST((short)1, "request"); 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: // REQUEST return REQUEST; 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 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.REQUEST, new libthrift091.meta_data.FieldMetaData("request", libthrift091.TFieldRequirementType.DEFAULT, new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, QueryRequest.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(queryMetric_args.class, metaDataMap); } public queryMetric_args() { } public queryMetric_args( QueryRequest request) { this(); this.request = request; } /** * Performs a deep copy on <i>other</i>. */ public queryMetric_args(queryMetric_args other) { if (other.isSetRequest()) { this.request = new QueryRequest(other.request); } } public queryMetric_args deepCopy() { return new queryMetric_args(this); } @Override public void clear() { this.request = null; } public QueryRequest getRequest() { return this.request; } public queryMetric_args setRequest(QueryRequest request) { this.request = request; return this; } public void unsetRequest() { this.request = null; } /** Returns true if field request is set (has been assigned a value) and false otherwise */ public boolean isSetRequest() { return this.request != null; } public void setRequestIsSet(boolean value) { if (!value) { this.request = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case REQUEST: if (value == null) { unsetRequest(); } else { setRequest((QueryRequest)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case REQUEST: return getRequest(); } 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 REQUEST: return isSetRequest(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof queryMetric_args) return this.equals((queryMetric_args)that); return false; } public boolean equals(queryMetric_args that) { if (that == null) return false; boolean this_present_request = true && this.isSetRequest(); boolean that_present_request = true && that.isSetRequest(); if (this_present_request || that_present_request) { if (!(this_present_request && that_present_request)) return false; if (!this.request.equals(that.request)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_request = true && (isSetRequest()); list.add(present_request); if (present_request) list.add(request); return list.hashCode(); } @Override public int compareTo(queryMetric_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetRequest()).compareTo(other.isSetRequest()); if (lastComparison != 0) { return lastComparison; } if (isSetRequest()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.request, other.request); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("queryMetric_args("); boolean first = true; sb.append("request:"); if (this.request == null) { sb.append("null"); } else { sb.append(this.request); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws libthrift091.TException { // check for required fields // check for sub-struct validity if (request != null) { request.validate(); } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private static class queryMetric_argsStandardSchemeFactory implements SchemeFactory { public queryMetric_argsStandardScheme getScheme() { return new queryMetric_argsStandardScheme(); } } private static class queryMetric_argsStandardScheme extends StandardScheme<queryMetric_args> { public void read(libthrift091.protocol.TProtocol iprot, queryMetric_args struct) throws libthrift091.TException { libthrift091.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == libthrift091.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // REQUEST if (schemeField.type == libthrift091.protocol.TType.STRUCT) { struct.request = new QueryRequest(); struct.request.read(iprot); struct.setRequestIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: libthrift091.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 struct.validate(); } public void write(libthrift091.protocol.TProtocol oprot, queryMetric_args struct) throws libthrift091.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.request != null) { oprot.writeFieldBegin(REQUEST_FIELD_DESC); struct.request.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class queryMetric_argsTupleSchemeFactory implements SchemeFactory { public queryMetric_argsTupleScheme getScheme() { return new queryMetric_argsTupleScheme(); } } private static class queryMetric_argsTupleScheme extends TupleScheme<queryMetric_args> { @Override public void write(libthrift091.protocol.TProtocol prot, queryMetric_args struct) throws libthrift091.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetRequest()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetRequest()) { struct.request.write(oprot); } } @Override public void read(libthrift091.protocol.TProtocol prot, queryMetric_args struct) throws libthrift091.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.request = new QueryRequest(); struct.request.read(iprot); struct.setRequestIsSet(true); } } } } public static class queryMetric_result implements libthrift091.TBase<queryMetric_result, queryMetric_result._Fields>, java.io.Serializable, Cloneable, Comparable<queryMetric_result> { private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("queryMetric_result"); private static final libthrift091.protocol.TField SUCCESS_FIELD_DESC = new libthrift091.protocol.TField("success", libthrift091.protocol.TType.MAP, (short)0); private static final libthrift091.protocol.TField SE_FIELD_DESC = new libthrift091.protocol.TField("se", libthrift091.protocol.TType.STRUCT, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new queryMetric_resultStandardSchemeFactory()); schemes.put(TupleScheme.class, new queryMetric_resultTupleSchemeFactory()); } public Map<Long,Double> success; // required public com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements libthrift091.TFieldIdEnum { SUCCESS((short)0, "success"), SE((short)1, "se"); 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 0: // SUCCESS return SUCCESS; case 1: // SE return SE; 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 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.SUCCESS, new libthrift091.meta_data.FieldMetaData("success", libthrift091.TFieldRequirementType.DEFAULT, 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)))); tmpMap.put(_Fields.SE, new libthrift091.meta_data.FieldMetaData("se", libthrift091.TFieldRequirementType.DEFAULT, new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(queryMetric_result.class, metaDataMap); } public queryMetric_result() { } public queryMetric_result( Map<Long,Double> success, com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { this(); this.success = success; this.se = se; } /** * Performs a deep copy on <i>other</i>. */ public queryMetric_result(queryMetric_result other) { if (other.isSetSuccess()) { Map<Long,Double> __this__success = new HashMap<Long,Double>(other.success); this.success = __this__success; } if (other.isSetSe()) { this.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(other.se); } } public queryMetric_result deepCopy() { return new queryMetric_result(this); } @Override public void clear() { this.success = null; this.se = null; } public int getSuccessSize() { return (this.success == null) ? 0 : this.success.size(); } public void putToSuccess(long key, double val) { if (this.success == null) { this.success = new HashMap<Long,Double>(); } this.success.put(key, val); } public Map<Long,Double> getSuccess() { return this.success; } public queryMetric_result setSuccess(Map<Long,Double> success) { this.success = success; return this; } public void unsetSuccess() { this.success = null; } /** Returns true if field success is set (has been assigned a value) and false otherwise */ public boolean isSetSuccess() { return this.success != null; } public void setSuccessIsSet(boolean value) { if (!value) { this.success = null; } } public com.xiaomi.infra.galaxy.metrics.thrift.ServiceException getSe() { return this.se; } public queryMetric_result setSe(com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { this.se = se; return this; } public void unsetSe() { this.se = null; } /** Returns true if field se is set (has been assigned a value) and false otherwise */ public boolean isSetSe() { return this.se != null; } public void setSeIsSet(boolean value) { if (!value) { this.se = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case SUCCESS: if (value == null) { unsetSuccess(); } else { setSuccess((Map<Long,Double>)value); } break; case SE: if (value == null) { unsetSe(); } else { setSe((com.xiaomi.infra.galaxy.metrics.thrift.ServiceException)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: return getSuccess(); case SE: return getSe(); } 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 SUCCESS: return isSetSuccess(); case SE: return isSetSe(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof queryMetric_result) return this.equals((queryMetric_result)that); return false; } public boolean equals(queryMetric_result that) { if (that == null) return false; boolean this_present_success = true && this.isSetSuccess(); boolean that_present_success = true && that.isSetSuccess(); if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (!this.success.equals(that.success)) return false; } boolean this_present_se = true && this.isSetSe(); boolean that_present_se = true && that.isSetSe(); if (this_present_se || that_present_se) { if (!(this_present_se && that_present_se)) return false; if (!this.se.equals(that.se)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_success = true && (isSetSuccess()); list.add(present_success); if (present_success) list.add(success); boolean present_se = true && (isSetSe()); list.add(present_se); if (present_se) list.add(se); return list.hashCode(); } @Override public int compareTo(queryMetric_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); if (lastComparison != 0) { return lastComparison; } if (isSetSuccess()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.success, other.success); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSe()).compareTo(other.isSetSe()); if (lastComparison != 0) { return lastComparison; } if (isSetSe()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.se, other.se); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("queryMetric_result("); boolean first = true; sb.append("success:"); if (this.success == null) { sb.append("null"); } else { sb.append(this.success); } first = false; if (!first) sb.append(", "); sb.append("se:"); if (this.se == null) { sb.append("null"); } else { sb.append(this.se); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws libthrift091.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private static class queryMetric_resultStandardSchemeFactory implements SchemeFactory { public queryMetric_resultStandardScheme getScheme() { return new queryMetric_resultStandardScheme(); } } private static class queryMetric_resultStandardScheme extends StandardScheme<queryMetric_result> { public void read(libthrift091.protocol.TProtocol iprot, queryMetric_result struct) throws libthrift091.TException { libthrift091.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == libthrift091.protocol.TType.STOP) { break; } switch (schemeField.id) { case 0: // SUCCESS if (schemeField.type == libthrift091.protocol.TType.MAP) { { libthrift091.protocol.TMap _map18 = iprot.readMapBegin(); struct.success = new HashMap<Long,Double>(2*_map18.size); long _key19; double _val20; for (int _i21 = 0; _i21 < _map18.size; ++_i21) { _key19 = iprot.readI64(); _val20 = iprot.readDouble(); struct.success.put(_key19, _val20); } iprot.readMapEnd(); } struct.setSuccessIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 1: // SE if (schemeField.type == libthrift091.protocol.TType.STRUCT) { struct.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(); struct.se.read(iprot); struct.setSeIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: libthrift091.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 struct.validate(); } public void write(libthrift091.protocol.TProtocol oprot, queryMetric_result struct) throws libthrift091.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new libthrift091.protocol.TMap(libthrift091.protocol.TType.I64, libthrift091.protocol.TType.DOUBLE, struct.success.size())); for (Map.Entry<Long, Double> _iter22 : struct.success.entrySet()) { oprot.writeI64(_iter22.getKey()); oprot.writeDouble(_iter22.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } if (struct.se != null) { oprot.writeFieldBegin(SE_FIELD_DESC); struct.se.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class queryMetric_resultTupleSchemeFactory implements SchemeFactory { public queryMetric_resultTupleScheme getScheme() { return new queryMetric_resultTupleScheme(); } } private static class queryMetric_resultTupleScheme extends TupleScheme<queryMetric_result> { @Override public void write(libthrift091.protocol.TProtocol prot, queryMetric_result struct) throws libthrift091.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { optionals.set(0); } if (struct.isSetSe()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); for (Map.Entry<Long, Double> _iter23 : struct.success.entrySet()) { oprot.writeI64(_iter23.getKey()); oprot.writeDouble(_iter23.getValue()); } } } if (struct.isSetSe()) { struct.se.write(oprot); } } @Override public void read(libthrift091.protocol.TProtocol prot, queryMetric_result struct) throws libthrift091.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { libthrift091.protocol.TMap _map24 = new libthrift091.protocol.TMap(libthrift091.protocol.TType.I64, libthrift091.protocol.TType.DOUBLE, iprot.readI32()); struct.success = new HashMap<Long,Double>(2*_map24.size); long _key25; double _val26; for (int _i27 = 0; _i27 < _map24.size; ++_i27) { _key25 = iprot.readI64(); _val26 = iprot.readDouble(); struct.success.put(_key25, _val26); } } struct.setSuccessIsSet(true); } if (incoming.get(1)) { struct.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(); struct.se.read(iprot); struct.setSeIsSet(true); } } } } public static class suggest_args implements libthrift091.TBase<suggest_args, suggest_args._Fields>, java.io.Serializable, Cloneable, Comparable<suggest_args> { private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("suggest_args"); private static final libthrift091.protocol.TField METRIC_PREFIX_FIELD_DESC = new libthrift091.protocol.TField("metricPrefix", libthrift091.protocol.TType.STRING, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new suggest_argsStandardSchemeFactory()); schemes.put(TupleScheme.class, new suggest_argsTupleSchemeFactory()); } public String metricPrefix; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements libthrift091.TFieldIdEnum { METRIC_PREFIX((short)1, "metricPrefix"); 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: // METRIC_PREFIX return METRIC_PREFIX; 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 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_PREFIX, new libthrift091.meta_data.FieldMetaData("metricPrefix", libthrift091.TFieldRequirementType.DEFAULT, new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(suggest_args.class, metaDataMap); } public suggest_args() { } public suggest_args( String metricPrefix) { this(); this.metricPrefix = metricPrefix; } /** * Performs a deep copy on <i>other</i>. */ public suggest_args(suggest_args other) { if (other.isSetMetricPrefix()) { this.metricPrefix = other.metricPrefix; } } public suggest_args deepCopy() { return new suggest_args(this); } @Override public void clear() { this.metricPrefix = null; } public String getMetricPrefix() { return this.metricPrefix; } public suggest_args setMetricPrefix(String metricPrefix) { this.metricPrefix = metricPrefix; return this; } public void unsetMetricPrefix() { this.metricPrefix = null; } /** Returns true if field metricPrefix is set (has been assigned a value) and false otherwise */ public boolean isSetMetricPrefix() { return this.metricPrefix != null; } public void setMetricPrefixIsSet(boolean value) { if (!value) { this.metricPrefix = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case METRIC_PREFIX: if (value == null) { unsetMetricPrefix(); } else { setMetricPrefix((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case METRIC_PREFIX: return getMetricPrefix(); } 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_PREFIX: return isSetMetricPrefix(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof suggest_args) return this.equals((suggest_args)that); return false; } public boolean equals(suggest_args that) { if (that == null) return false; boolean this_present_metricPrefix = true && this.isSetMetricPrefix(); boolean that_present_metricPrefix = true && that.isSetMetricPrefix(); if (this_present_metricPrefix || that_present_metricPrefix) { if (!(this_present_metricPrefix && that_present_metricPrefix)) return false; if (!this.metricPrefix.equals(that.metricPrefix)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_metricPrefix = true && (isSetMetricPrefix()); list.add(present_metricPrefix); if (present_metricPrefix) list.add(metricPrefix); return list.hashCode(); } @Override public int compareTo(suggest_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetMetricPrefix()).compareTo(other.isSetMetricPrefix()); if (lastComparison != 0) { return lastComparison; } if (isSetMetricPrefix()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.metricPrefix, other.metricPrefix); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("suggest_args("); boolean first = true; sb.append("metricPrefix:"); if (this.metricPrefix == null) { sb.append("null"); } else { sb.append(this.metricPrefix); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws libthrift091.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private static class suggest_argsStandardSchemeFactory implements SchemeFactory { public suggest_argsStandardScheme getScheme() { return new suggest_argsStandardScheme(); } } private static class suggest_argsStandardScheme extends StandardScheme<suggest_args> { public void read(libthrift091.protocol.TProtocol iprot, suggest_args struct) throws libthrift091.TException { libthrift091.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == libthrift091.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // METRIC_PREFIX if (schemeField.type == libthrift091.protocol.TType.STRING) { struct.metricPrefix = iprot.readString(); struct.setMetricPrefixIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: libthrift091.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 struct.validate(); } public void write(libthrift091.protocol.TProtocol oprot, suggest_args struct) throws libthrift091.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.metricPrefix != null) { oprot.writeFieldBegin(METRIC_PREFIX_FIELD_DESC); oprot.writeString(struct.metricPrefix); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class suggest_argsTupleSchemeFactory implements SchemeFactory { public suggest_argsTupleScheme getScheme() { return new suggest_argsTupleScheme(); } } private static class suggest_argsTupleScheme extends TupleScheme<suggest_args> { @Override public void write(libthrift091.protocol.TProtocol prot, suggest_args struct) throws libthrift091.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetMetricPrefix()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetMetricPrefix()) { oprot.writeString(struct.metricPrefix); } } @Override public void read(libthrift091.protocol.TProtocol prot, suggest_args struct) throws libthrift091.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.metricPrefix = iprot.readString(); struct.setMetricPrefixIsSet(true); } } } } public static class suggest_result implements libthrift091.TBase<suggest_result, suggest_result._Fields>, java.io.Serializable, Cloneable, Comparable<suggest_result> { private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("suggest_result"); private static final libthrift091.protocol.TField SUCCESS_FIELD_DESC = new libthrift091.protocol.TField("success", libthrift091.protocol.TType.LIST, (short)0); private static final libthrift091.protocol.TField SE_FIELD_DESC = new libthrift091.protocol.TField("se", libthrift091.protocol.TType.STRUCT, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new suggest_resultStandardSchemeFactory()); schemes.put(TupleScheme.class, new suggest_resultTupleSchemeFactory()); } public List<MetricKey> success; // required public com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements libthrift091.TFieldIdEnum { SUCCESS((short)0, "success"), SE((short)1, "se"); 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 0: // SUCCESS return SUCCESS; case 1: // SE return SE; 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 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.SUCCESS, new libthrift091.meta_data.FieldMetaData("success", libthrift091.TFieldRequirementType.DEFAULT, new libthrift091.meta_data.ListMetaData(libthrift091.protocol.TType.LIST, new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, MetricKey.class)))); tmpMap.put(_Fields.SE, new libthrift091.meta_data.FieldMetaData("se", libthrift091.TFieldRequirementType.DEFAULT, new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(suggest_result.class, metaDataMap); } public suggest_result() { } public suggest_result( List<MetricKey> success, com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { this(); this.success = success; this.se = se; } /** * Performs a deep copy on <i>other</i>. */ public suggest_result(suggest_result other) { if (other.isSetSuccess()) { List<MetricKey> __this__success = new ArrayList<MetricKey>(other.success.size()); for (MetricKey other_element : other.success) { __this__success.add(new MetricKey(other_element)); } this.success = __this__success; } if (other.isSetSe()) { this.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(other.se); } } public suggest_result deepCopy() { return new suggest_result(this); } @Override public void clear() { this.success = null; this.se = null; } public int getSuccessSize() { return (this.success == null) ? 0 : this.success.size(); } public java.util.Iterator<MetricKey> getSuccessIterator() { return (this.success == null) ? null : this.success.iterator(); } public void addToSuccess(MetricKey elem) { if (this.success == null) { this.success = new ArrayList<MetricKey>(); } this.success.add(elem); } public List<MetricKey> getSuccess() { return this.success; } public suggest_result setSuccess(List<MetricKey> success) { this.success = success; return this; } public void unsetSuccess() { this.success = null; } /** Returns true if field success is set (has been assigned a value) and false otherwise */ public boolean isSetSuccess() { return this.success != null; } public void setSuccessIsSet(boolean value) { if (!value) { this.success = null; } } public com.xiaomi.infra.galaxy.metrics.thrift.ServiceException getSe() { return this.se; } public suggest_result setSe(com.xiaomi.infra.galaxy.metrics.thrift.ServiceException se) { this.se = se; return this; } public void unsetSe() { this.se = null; } /** Returns true if field se is set (has been assigned a value) and false otherwise */ public boolean isSetSe() { return this.se != null; } public void setSeIsSet(boolean value) { if (!value) { this.se = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case SUCCESS: if (value == null) { unsetSuccess(); } else { setSuccess((List<MetricKey>)value); } break; case SE: if (value == null) { unsetSe(); } else { setSe((com.xiaomi.infra.galaxy.metrics.thrift.ServiceException)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: return getSuccess(); case SE: return getSe(); } 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 SUCCESS: return isSetSuccess(); case SE: return isSetSe(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof suggest_result) return this.equals((suggest_result)that); return false; } public boolean equals(suggest_result that) { if (that == null) return false; boolean this_present_success = true && this.isSetSuccess(); boolean that_present_success = true && that.isSetSuccess(); if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (!this.success.equals(that.success)) return false; } boolean this_present_se = true && this.isSetSe(); boolean that_present_se = true && that.isSetSe(); if (this_present_se || that_present_se) { if (!(this_present_se && that_present_se)) return false; if (!this.se.equals(that.se)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_success = true && (isSetSuccess()); list.add(present_success); if (present_success) list.add(success); boolean present_se = true && (isSetSe()); list.add(present_se); if (present_se) list.add(se); return list.hashCode(); } @Override public int compareTo(suggest_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); if (lastComparison != 0) { return lastComparison; } if (isSetSuccess()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.success, other.success); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSe()).compareTo(other.isSetSe()); if (lastComparison != 0) { return lastComparison; } if (isSetSe()) { lastComparison = libthrift091.TBaseHelper.compareTo(this.se, other.se); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("suggest_result("); boolean first = true; sb.append("success:"); if (this.success == null) { sb.append("null"); } else { sb.append(this.success); } first = false; if (!first) sb.append(", "); sb.append("se:"); if (this.se == null) { sb.append("null"); } else { sb.append(this.se); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws libthrift091.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in))); } catch (libthrift091.TException te) { throw new java.io.IOException(te); } } private static class suggest_resultStandardSchemeFactory implements SchemeFactory { public suggest_resultStandardScheme getScheme() { return new suggest_resultStandardScheme(); } } private static class suggest_resultStandardScheme extends StandardScheme<suggest_result> { public void read(libthrift091.protocol.TProtocol iprot, suggest_result struct) throws libthrift091.TException { libthrift091.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == libthrift091.protocol.TType.STOP) { break; } switch (schemeField.id) { case 0: // SUCCESS if (schemeField.type == libthrift091.protocol.TType.LIST) { { libthrift091.protocol.TList _list28 = iprot.readListBegin(); struct.success = new ArrayList<MetricKey>(_list28.size); MetricKey _elem29; for (int _i30 = 0; _i30 < _list28.size; ++_i30) { _elem29 = new MetricKey(); _elem29.read(iprot); struct.success.add(_elem29); } iprot.readListEnd(); } struct.setSuccessIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 1: // SE if (schemeField.type == libthrift091.protocol.TType.STRUCT) { struct.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(); struct.se.read(iprot); struct.setSeIsSet(true); } else { libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: libthrift091.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 struct.validate(); } public void write(libthrift091.protocol.TProtocol oprot, suggest_result struct) throws libthrift091.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, struct.success.size())); for (MetricKey _iter31 : struct.success) { _iter31.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.se != null) { oprot.writeFieldBegin(SE_FIELD_DESC); struct.se.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class suggest_resultTupleSchemeFactory implements SchemeFactory { public suggest_resultTupleScheme getScheme() { return new suggest_resultTupleScheme(); } } private static class suggest_resultTupleScheme extends TupleScheme<suggest_result> { @Override public void write(libthrift091.protocol.TProtocol prot, suggest_result struct) throws libthrift091.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { optionals.set(0); } if (struct.isSetSe()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); for (MetricKey _iter32 : struct.success) { _iter32.write(oprot); } } } if (struct.isSetSe()) { struct.se.write(oprot); } } @Override public void read(libthrift091.protocol.TProtocol prot, suggest_result struct) throws libthrift091.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { libthrift091.protocol.TList _list33 = new libthrift091.protocol.TList(libthrift091.protocol.TType.STRUCT, iprot.readI32()); struct.success = new ArrayList<MetricKey>(_list33.size); MetricKey _elem34; for (int _i35 = 0; _i35 < _list33.size; ++_i35) { _elem34 = new MetricKey(); _elem34.read(iprot); struct.success.add(_elem34); } } struct.setSuccessIsSet(true); } if (incoming.get(1)) { struct.se = new com.xiaomi.infra.galaxy.metrics.thrift.ServiceException(); struct.se.read(iprot); struct.setSeIsSet(true); } } } } }