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

io.snappydata.thrift.CatalogFunctionObject Maven / Gradle / Ivy

There is a newer version: 1.6.7
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package io.snappydata.thrift;

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.3)", date = "2018-12-10")
public class CatalogFunctionObject 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("CatalogFunctionObject");

  private static final org.apache.thrift.protocol.TField FUNCTION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("functionName", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField SCHEMA_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("schemaName", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField RESOURCES_FIELD_DESC = new org.apache.thrift.protocol.TField("resources", org.apache.thrift.protocol.TType.LIST, (short)4);

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

  public String functionName; // required
  public String schemaName; // optional
  public String className; // required
  public List resources; // 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 {
    FUNCTION_NAME((short)1, "functionName"),
    SCHEMA_NAME((short)2, "schemaName"),
    CLASS_NAME((short)3, "className"),
    RESOURCES((short)4, "resources");

    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: // FUNCTION_NAME
          return FUNCTION_NAME;
        case 2: // SCHEMA_NAME
          return SCHEMA_NAME;
        case 3: // CLASS_NAME
          return CLASS_NAME;
        case 4: // RESOURCES
          return RESOURCES;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.SCHEMA_NAME};
  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.FUNCTION_NAME, new org.apache.thrift.meta_data.FieldMetaData("functionName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SCHEMA_NAME, new org.apache.thrift.meta_data.FieldMetaData("schemaName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("className", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.RESOURCES, new org.apache.thrift.meta_data.FieldMetaData("resources", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CatalogFunctionObject.class, metaDataMap);
  }

  public CatalogFunctionObject() {
  }

  public CatalogFunctionObject(
    String functionName,
    String className,
    List resources)
  {
    this();
    this.functionName = functionName;
    this.className = className;
    this.resources = resources;
  }

  /**
   * Performs a deep copy on other.
   */
  public CatalogFunctionObject(CatalogFunctionObject other) {
    if (other.isSetFunctionName()) {
      this.functionName = other.functionName;
    }
    if (other.isSetSchemaName()) {
      this.schemaName = other.schemaName;
    }
    if (other.isSetClassName()) {
      this.className = other.className;
    }
    if (other.isSetResources()) {
      List __this__resources = new ArrayList(other.resources);
      this.resources = __this__resources;
    }
  }

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

  @Override
  public void clear() {
    this.functionName = null;
    this.schemaName = null;
    this.className = null;
    this.resources = null;
  }

  public String getFunctionName() {
    return this.functionName;
  }

  public CatalogFunctionObject setFunctionName(String functionName) {
    this.functionName = functionName;
    return this;
  }

  public void unsetFunctionName() {
    this.functionName = null;
  }

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

  public void setFunctionNameIsSet(boolean value) {
    if (!value) {
      this.functionName = null;
    }
  }

  public String getSchemaName() {
    return this.schemaName;
  }

  public CatalogFunctionObject setSchemaName(String schemaName) {
    this.schemaName = schemaName;
    return this;
  }

  public void unsetSchemaName() {
    this.schemaName = null;
  }

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

  public void setSchemaNameIsSet(boolean value) {
    if (!value) {
      this.schemaName = null;
    }
  }

  public String getClassName() {
    return this.className;
  }

  public CatalogFunctionObject setClassName(String className) {
    this.className = className;
    return this;
  }

  public void unsetClassName() {
    this.className = null;
  }

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

  public void setClassNameIsSet(boolean value) {
    if (!value) {
      this.className = null;
    }
  }

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

  public java.util.Iterator getResourcesIterator() {
    return (this.resources == null) ? null : this.resources.iterator();
  }

  public void addToResources(String elem) {
    if (this.resources == null) {
      this.resources = new ArrayList();
    }
    this.resources.add(elem);
  }

  public List getResources() {
    return this.resources;
  }

  public CatalogFunctionObject setResources(List resources) {
    this.resources = resources;
    return this;
  }

  public void unsetResources() {
    this.resources = null;
  }

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

  public void setResourcesIsSet(boolean value) {
    if (!value) {
      this.resources = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case FUNCTION_NAME:
      if (value == null) {
        unsetFunctionName();
      } else {
        setFunctionName((String)value);
      }
      break;

    case SCHEMA_NAME:
      if (value == null) {
        unsetSchemaName();
      } else {
        setSchemaName((String)value);
      }
      break;

    case CLASS_NAME:
      if (value == null) {
        unsetClassName();
      } else {
        setClassName((String)value);
      }
      break;

    case RESOURCES:
      if (value == null) {
        unsetResources();
      } else {
        setResources((List)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case FUNCTION_NAME:
      return getFunctionName();

    case SCHEMA_NAME:
      return getSchemaName();

    case CLASS_NAME:
      return getClassName();

    case RESOURCES:
      return getResources();

    }
    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 FUNCTION_NAME:
      return isSetFunctionName();
    case SCHEMA_NAME:
      return isSetSchemaName();
    case CLASS_NAME:
      return isSetClassName();
    case RESOURCES:
      return isSetResources();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_functionName = true && this.isSetFunctionName();
    boolean that_present_functionName = true && that.isSetFunctionName();
    if (this_present_functionName || that_present_functionName) {
      if (!(this_present_functionName && that_present_functionName))
        return false;
      if (!this.functionName.equals(that.functionName))
        return false;
    }

    boolean this_present_schemaName = true && this.isSetSchemaName();
    boolean that_present_schemaName = true && that.isSetSchemaName();
    if (this_present_schemaName || that_present_schemaName) {
      if (!(this_present_schemaName && that_present_schemaName))
        return false;
      if (!this.schemaName.equals(that.schemaName))
        return false;
    }

    boolean this_present_className = true && this.isSetClassName();
    boolean that_present_className = true && that.isSetClassName();
    if (this_present_className || that_present_className) {
      if (!(this_present_className && that_present_className))
        return false;
      if (!this.className.equals(that.className))
        return false;
    }

    boolean this_present_resources = true && this.isSetResources();
    boolean that_present_resources = true && that.isSetResources();
    if (this_present_resources || that_present_resources) {
      if (!(this_present_resources && that_present_resources))
        return false;
      if (!this.resources.equals(that.resources))
        return false;
    }

    return true;
  }

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

    boolean present_functionName = true && (isSetFunctionName());
    list.add(present_functionName);
    if (present_functionName)
      list.add(functionName);

    boolean present_schemaName = true && (isSetSchemaName());
    list.add(present_schemaName);
    if (present_schemaName)
      list.add(schemaName);

    boolean present_className = true && (isSetClassName());
    list.add(present_className);
    if (present_className)
      list.add(className);

    boolean present_resources = true && (isSetResources());
    list.add(present_resources);
    if (present_resources)
      list.add(resources);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetFunctionName()).compareTo(other.isSetFunctionName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFunctionName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.functionName, other.functionName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSchemaName()).compareTo(other.isSetSchemaName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSchemaName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.schemaName, other.schemaName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetClassName()).compareTo(other.isSetClassName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetClassName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.className, other.className);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetResources()).compareTo(other.isSetResources());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResources()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resources, other.resources);
      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("CatalogFunctionObject(");
    boolean first = true;

    sb.append("functionName:");
    if (this.functionName == null) {
      sb.append("null");
    } else {
      sb.append(this.functionName);
    }
    first = false;
    if (isSetSchemaName()) {
      if (!first) sb.append(", ");
      sb.append("schemaName:");
      if (this.schemaName == null) {
        sb.append("null");
      } else {
        sb.append(this.schemaName);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("className:");
    if (this.className == null) {
      sb.append("null");
    } else {
      sb.append(this.className);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("resources:");
    if (this.resources == null) {
      sb.append("null");
    } else {
      sb.append(this.resources);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (functionName == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'functionName' was not present! Struct: " + toString());
    }
    if (className == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'className' was not present! Struct: " + toString());
    }
    if (resources == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'resources' 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 CatalogFunctionObjectStandardSchemeFactory implements SchemeFactory {
    public CatalogFunctionObjectStandardScheme getScheme() {
      return new CatalogFunctionObjectStandardScheme();
    }
  }

  private static class CatalogFunctionObjectStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, CatalogFunctionObject 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: // FUNCTION_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.functionName = iprot.readString();
              struct.setFunctionNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SCHEMA_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.schemaName = iprot.readString();
              struct.setSchemaNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // CLASS_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.className = iprot.readString();
              struct.setClassNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // RESOURCES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list382 = iprot.readListBegin();
                struct.resources = new ArrayList(_list382.size);
                String _elem383;
                for (int _i384 = 0; _i384 < _list382.size; ++_i384)
                {
                  _elem383 = iprot.readString();
                  struct.resources.add(_elem383);
                }
                iprot.readListEnd();
              }
              struct.setResourcesIsSet(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, CatalogFunctionObject struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.functionName != null) {
        oprot.writeFieldBegin(FUNCTION_NAME_FIELD_DESC);
        oprot.writeString(struct.functionName);
        oprot.writeFieldEnd();
      }
      if (struct.schemaName != null) {
        if (struct.isSetSchemaName()) {
          oprot.writeFieldBegin(SCHEMA_NAME_FIELD_DESC);
          oprot.writeString(struct.schemaName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.className != null) {
        oprot.writeFieldBegin(CLASS_NAME_FIELD_DESC);
        oprot.writeString(struct.className);
        oprot.writeFieldEnd();
      }
      if (struct.resources != null) {
        oprot.writeFieldBegin(RESOURCES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.resources.size()));
          for (String _iter385 : struct.resources)
          {
            oprot.writeString(_iter385);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class CatalogFunctionObjectTupleSchemeFactory implements SchemeFactory {
    public CatalogFunctionObjectTupleScheme getScheme() {
      return new CatalogFunctionObjectTupleScheme();
    }
  }

  private static class CatalogFunctionObjectTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, CatalogFunctionObject struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeString(struct.functionName);
      oprot.writeString(struct.className);
      {
        oprot.writeI32(struct.resources.size());
        for (String _iter386 : struct.resources)
        {
          oprot.writeString(_iter386);
        }
      }
      BitSet optionals = new BitSet();
      if (struct.isSetSchemaName()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetSchemaName()) {
        oprot.writeString(struct.schemaName);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, CatalogFunctionObject struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.functionName = iprot.readString();
      struct.setFunctionNameIsSet(true);
      struct.className = iprot.readString();
      struct.setClassNameIsSet(true);
      {
        org.apache.thrift.protocol.TList _list387 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
        struct.resources = new ArrayList(_list387.size);
        String _elem388;
        for (int _i389 = 0; _i389 < _list387.size; ++_i389)
        {
          _elem388 = iprot.readString();
          struct.resources.add(_elem388);
        }
      }
      struct.setResourcesIsSet(true);
      BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        struct.schemaName = iprot.readString();
        struct.setSchemaNameIsSet(true);
      }
    }
  }

}