All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.uber.tchannel.messages.generated.ThriftIDLs Maven / Gradle / Ivy

There is a newer version: 0.8.30
Show 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.uber.tchannel.messages.generated;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-3-3")
public class ThriftIDLs implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftIDLs");

  private static final org.apache.thrift.protocol.TField IDLS_FIELD_DESC = new org.apache.thrift.protocol.TField("idls", org.apache.thrift.protocol.TType.MAP, (short)1);
  private static final org.apache.thrift.protocol.TField ENTRY_POINT_FIELD_DESC = new org.apache.thrift.protocol.TField("entryPoint", org.apache.thrift.protocol.TType.STRING, (short)2);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new ThriftIDLsStandardSchemeFactory());
    schemes.put(TupleScheme.class, new ThriftIDLsTupleSchemeFactory());
  }

  private Map idls; // required
  private String entryPoint; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    IDLS((short)1, "idls"),
    ENTRY_POINT((short)2, "entryPoint");

    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: // IDLS
          return IDLS;
        case 2: // ENTRY_POINT
          return ENTRY_POINT;
        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, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.IDLS, new org.apache.thrift.meta_data.FieldMetaData("idls", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING            , "filename"), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.ENTRY_POINT, new org.apache.thrift.meta_data.FieldMetaData("entryPoint", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "filename")));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftIDLs.class, metaDataMap);
  }

  public ThriftIDLs() {
  }

  public ThriftIDLs(
    Map idls,
    String entryPoint)
  {
    this();
    this.idls = idls;
    this.entryPoint = entryPoint;
  }

  /**
   * Performs a deep copy on other.
   */
  public ThriftIDLs(ThriftIDLs other) {
    if (other.isSetIdls()) {
      Map __this__idls = new HashMap(other.idls.size());
      for (Map.Entry other_element : other.idls.entrySet()) {

        String other_element_key = other_element.getKey();
        String other_element_value = other_element.getValue();

        String __this__idls_copy_key = other_element_key;

        String __this__idls_copy_value = other_element_value;

        __this__idls.put(__this__idls_copy_key, __this__idls_copy_value);
      }
      this.idls = __this__idls;
    }
    if (other.isSetEntryPoint()) {
      this.entryPoint = other.entryPoint;
    }
  }

  public ThriftIDLs deepCopy() {
    return new ThriftIDLs(this);
  }

  @Override
  public void clear() {
    this.idls = null;
    this.entryPoint = null;
  }

  public int getIdlsSize() {
    return (this.idls == null) ? 0 : this.idls.size();
  }

  public void putToIdls(String key, String val) {
    if (this.idls == null) {
      this.idls = new HashMap();
    }
    this.idls.put(key, val);
  }

  public Map getIdls() {
    return this.idls;
  }

  public ThriftIDLs setIdls(Map idls) {
    this.idls = idls;
    return this;
  }

  public void unsetIdls() {
    this.idls = null;
  }

  /** Returns true if field idls is set (has been assigned a value) and false otherwise */
  public boolean isSetIdls() {
    return this.idls != null;
  }

  public void setIdlsIsSet(boolean value) {
    if (!value) {
      this.idls = null;
    }
  }

  public String getEntryPoint() {
    return this.entryPoint;
  }

  public ThriftIDLs setEntryPoint(String entryPoint) {
    this.entryPoint = entryPoint;
    return this;
  }

  public void unsetEntryPoint() {
    this.entryPoint = null;
  }

  /** Returns true if field entryPoint is set (has been assigned a value) and false otherwise */
  public boolean isSetEntryPoint() {
    return this.entryPoint != null;
  }

  public void setEntryPointIsSet(boolean value) {
    if (!value) {
      this.entryPoint = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case IDLS:
      if (value == null) {
        unsetIdls();
      } else {
        setIdls((Map)value);
      }
      break;

    case ENTRY_POINT:
      if (value == null) {
        unsetEntryPoint();
      } else {
        setEntryPoint((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case IDLS:
      return getIdls();

    case ENTRY_POINT:
      return getEntryPoint();

    }
    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 IDLS:
      return isSetIdls();
    case ENTRY_POINT:
      return isSetEntryPoint();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof ThriftIDLs)
      return this.equals((ThriftIDLs)that);
    return false;
  }

  public boolean equals(ThriftIDLs that) {
    if (that == null)
      return false;

    boolean this_present_idls = true && this.isSetIdls();
    boolean that_present_idls = true && that.isSetIdls();
    if (this_present_idls || that_present_idls) {
      if (!(this_present_idls && that_present_idls))
        return false;
      if (!this.idls.equals(that.idls))
        return false;
    }

    boolean this_present_entryPoint = true && this.isSetEntryPoint();
    boolean that_present_entryPoint = true && that.isSetEntryPoint();
    if (this_present_entryPoint || that_present_entryPoint) {
      if (!(this_present_entryPoint && that_present_entryPoint))
        return false;
      if (!this.entryPoint.equals(that.entryPoint))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_idls = true && (isSetIdls());
    list.add(present_idls);
    if (present_idls)
      list.add(idls);

    boolean present_entryPoint = true && (isSetEntryPoint());
    list.add(present_entryPoint);
    if (present_entryPoint)
      list.add(entryPoint);

    return list.hashCode();
  }

  @Override
  public int compareTo(ThriftIDLs other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetIdls()).compareTo(other.isSetIdls());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIdls()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.idls, other.idls);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEntryPoint()).compareTo(other.isSetEntryPoint());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEntryPoint()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.entryPoint, other.entryPoint);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ThriftIDLs(");
    boolean first = true;

    sb.append("idls:");
    if (this.idls == null) {
      sb.append("null");
    } else {
      sb.append(this.idls);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("entryPoint:");
    if (this.entryPoint == null) {
      sb.append("null");
    } else {
      sb.append(this.entryPoint);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (idls == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'idls' was not present! Struct: " + toString());
    }
    if (entryPoint == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'entryPoint' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class ThriftIDLsStandardSchemeFactory implements SchemeFactory {
    public ThriftIDLsStandardScheme getScheme() {
      return new ThriftIDLsStandardScheme();
    }
  }

  private static class ThriftIDLsStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftIDLs struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // IDLS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
                struct.idls = new HashMap(2*_map0.size);
                String _key1;
                String _val2;
                for (int _i3 = 0; _i3 < _map0.size; ++_i3)
                {
                  _key1 = iprot.readString();
                  _val2 = iprot.readString();
                  struct.idls.put(_key1, _val2);
                }
                iprot.readMapEnd();
              }
              struct.setIdlsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ENTRY_POINT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.entryPoint = iprot.readString();
              struct.setEntryPointIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, ThriftIDLs struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.idls != null) {
        oprot.writeFieldBegin(IDLS_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.idls.size()));
          for (Map.Entry _iter4 : struct.idls.entrySet())
          {
            oprot.writeString(_iter4.getKey());
            oprot.writeString(_iter4.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.entryPoint != null) {
        oprot.writeFieldBegin(ENTRY_POINT_FIELD_DESC);
        oprot.writeString(struct.entryPoint);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ThriftIDLsTupleSchemeFactory implements SchemeFactory {
    public ThriftIDLsTupleScheme getScheme() {
      return new ThriftIDLsTupleScheme();
    }
  }

  private static class ThriftIDLsTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ThriftIDLs struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      {
        oprot.writeI32(struct.idls.size());
        for (Map.Entry _iter5 : struct.idls.entrySet())
        {
          oprot.writeString(_iter5.getKey());
          oprot.writeString(_iter5.getValue());
        }
      }
      oprot.writeString(struct.entryPoint);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ThriftIDLs struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
        struct.idls = new HashMap(2*_map6.size);
        String _key7;
        String _val8;
        for (int _i9 = 0; _i9 < _map6.size; ++_i9)
        {
          _key7 = iprot.readString();
          _val8 = iprot.readString();
          struct.idls.put(_key7, _val8);
        }
      }
      struct.setIdlsIsSet(true);
      struct.entryPoint = iprot.readString();
      struct.setEntryPointIsSet(true);
    }
  }

}