/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.curator.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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DiscoveryServiceLowLevel {

  public interface Iface {

    public DiscoveryInstance queryForInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, String id) throws CuratorException, org.apache.thrift.TException;

    public List<DiscoveryInstance> queryForInstances(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name) throws CuratorException, org.apache.thrift.TException;

    public List<String> queryForNames(CuratorProjection projection, DiscoveryProjection discoveryProjection) throws CuratorException, org.apache.thrift.TException;

    public void registerInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws CuratorException, org.apache.thrift.TException;

    public void unregisterInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws CuratorException, org.apache.thrift.TException;

    public void updateInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws CuratorException, org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void queryForInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void queryForInstances(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void queryForNames(CuratorProjection projection, DiscoveryProjection discoveryProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void registerInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void unregisterInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void updateInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public DiscoveryInstance queryForInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, String id) throws CuratorException, org.apache.thrift.TException
    {
      send_queryForInstance(projection, discoveryProjection, name, id);
      return recv_queryForInstance();
    }

    public void send_queryForInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, String id) throws org.apache.thrift.TException
    {
      queryForInstance_args args = new queryForInstance_args();
      args.setProjection(projection);
      args.setDiscoveryProjection(discoveryProjection);
      args.setName(name);
      args.setId(id);
      sendBase("queryForInstance", args);
    }

    public DiscoveryInstance recv_queryForInstance() throws CuratorException, org.apache.thrift.TException
    {
      queryForInstance_result result = new queryForInstance_result();
      receiveBase(result, "queryForInstance");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "queryForInstance failed: unknown result");
    }

    public List<DiscoveryInstance> queryForInstances(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name) throws CuratorException, org.apache.thrift.TException
    {
      send_queryForInstances(projection, discoveryProjection, name);
      return recv_queryForInstances();
    }

    public void send_queryForInstances(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name) throws org.apache.thrift.TException
    {
      queryForInstances_args args = new queryForInstances_args();
      args.setProjection(projection);
      args.setDiscoveryProjection(discoveryProjection);
      args.setName(name);
      sendBase("queryForInstances", args);
    }

    public List<DiscoveryInstance> recv_queryForInstances() throws CuratorException, org.apache.thrift.TException
    {
      queryForInstances_result result = new queryForInstances_result();
      receiveBase(result, "queryForInstances");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "queryForInstances failed: unknown result");
    }

    public List<String> queryForNames(CuratorProjection projection, DiscoveryProjection discoveryProjection) throws CuratorException, org.apache.thrift.TException
    {
      send_queryForNames(projection, discoveryProjection);
      return recv_queryForNames();
    }

    public void send_queryForNames(CuratorProjection projection, DiscoveryProjection discoveryProjection) throws org.apache.thrift.TException
    {
      queryForNames_args args = new queryForNames_args();
      args.setProjection(projection);
      args.setDiscoveryProjection(discoveryProjection);
      sendBase("queryForNames", args);
    }

    public List<String> recv_queryForNames() throws CuratorException, org.apache.thrift.TException
    {
      queryForNames_result result = new queryForNames_result();
      receiveBase(result, "queryForNames");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex1 != null) {
        throw result.ex1;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "queryForNames failed: unknown result");
    }

    public void registerInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws CuratorException, org.apache.thrift.TException
    {
      send_registerInstance(projection, discoveryProjection, instance);
      recv_registerInstance();
    }

    public void send_registerInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws org.apache.thrift.TException
    {
      registerInstance_args args = new registerInstance_args();
      args.setProjection(projection);
      args.setDiscoveryProjection(discoveryProjection);
      args.setInstance(instance);
      sendBase("registerInstance", args);
    }

    public void recv_registerInstance() throws CuratorException, org.apache.thrift.TException
    {
      registerInstance_result result = new registerInstance_result();
      receiveBase(result, "registerInstance");
      if (result.ex1 != null) {
        throw result.ex1;
      }
      return;
    }

    public void unregisterInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws CuratorException, org.apache.thrift.TException
    {
      send_unregisterInstance(projection, discoveryProjection, instance);
      recv_unregisterInstance();
    }

    public void send_unregisterInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws org.apache.thrift.TException
    {
      unregisterInstance_args args = new unregisterInstance_args();
      args.setProjection(projection);
      args.setDiscoveryProjection(discoveryProjection);
      args.setInstance(instance);
      sendBase("unregisterInstance", args);
    }

    public void recv_unregisterInstance() throws CuratorException, org.apache.thrift.TException
    {
      unregisterInstance_result result = new unregisterInstance_result();
      receiveBase(result, "unregisterInstance");
      if (result.ex1 != null) {
        throw result.ex1;
      }
      return;
    }

    public void updateInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws CuratorException, org.apache.thrift.TException
    {
      send_updateInstance(projection, discoveryProjection, instance);
      recv_updateInstance();
    }

    public void send_updateInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance) throws org.apache.thrift.TException
    {
      updateInstance_args args = new updateInstance_args();
      args.setProjection(projection);
      args.setDiscoveryProjection(discoveryProjection);
      args.setInstance(instance);
      sendBase("updateInstance", args);
    }

    public void recv_updateInstance() throws CuratorException, org.apache.thrift.TException
    {
      updateInstance_result result = new updateInstance_result();
      receiveBase(result, "updateInstance");
      if (result.ex1 != null) {
        throw result.ex1;
      }
      return;
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void queryForInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      queryForInstance_call method_call = new queryForInstance_call(projection, discoveryProjection, name, id, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class queryForInstance_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProjection discoveryProjection;
      private String name;
      private String id;
      public queryForInstance_call(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, String id, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.discoveryProjection = discoveryProjection;
        this.name = name;
        this.id = id;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("queryForInstance", org.apache.thrift.protocol.TMessageType.CALL, 0));
        queryForInstance_args args = new queryForInstance_args();
        args.setProjection(projection);
        args.setDiscoveryProjection(discoveryProjection);
        args.setName(name);
        args.setId(id);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public DiscoveryInstance getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_queryForInstance();
      }
    }

    public void queryForInstances(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      queryForInstances_call method_call = new queryForInstances_call(projection, discoveryProjection, name, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class queryForInstances_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProjection discoveryProjection;
      private String name;
      public queryForInstances_call(CuratorProjection projection, DiscoveryProjection discoveryProjection, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.discoveryProjection = discoveryProjection;
        this.name = name;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("queryForInstances", org.apache.thrift.protocol.TMessageType.CALL, 0));
        queryForInstances_args args = new queryForInstances_args();
        args.setProjection(projection);
        args.setDiscoveryProjection(discoveryProjection);
        args.setName(name);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<DiscoveryInstance> getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_queryForInstances();
      }
    }

    public void queryForNames(CuratorProjection projection, DiscoveryProjection discoveryProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      queryForNames_call method_call = new queryForNames_call(projection, discoveryProjection, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class queryForNames_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProjection discoveryProjection;
      public queryForNames_call(CuratorProjection projection, DiscoveryProjection discoveryProjection, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.discoveryProjection = discoveryProjection;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("queryForNames", org.apache.thrift.protocol.TMessageType.CALL, 0));
        queryForNames_args args = new queryForNames_args();
        args.setProjection(projection);
        args.setDiscoveryProjection(discoveryProjection);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<String> getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_queryForNames();
      }
    }

    public void registerInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      registerInstance_call method_call = new registerInstance_call(projection, discoveryProjection, instance, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class registerInstance_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProjection discoveryProjection;
      private DiscoveryInstance instance;
      public registerInstance_call(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.discoveryProjection = discoveryProjection;
        this.instance = instance;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("registerInstance", org.apache.thrift.protocol.TMessageType.CALL, 0));
        registerInstance_args args = new registerInstance_args();
        args.setProjection(projection);
        args.setDiscoveryProjection(discoveryProjection);
        args.setInstance(instance);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_registerInstance();
      }
    }

    public void unregisterInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      unregisterInstance_call method_call = new unregisterInstance_call(projection, discoveryProjection, instance, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class unregisterInstance_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProjection discoveryProjection;
      private DiscoveryInstance instance;
      public unregisterInstance_call(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.discoveryProjection = discoveryProjection;
        this.instance = instance;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("unregisterInstance", org.apache.thrift.protocol.TMessageType.CALL, 0));
        unregisterInstance_args args = new unregisterInstance_args();
        args.setProjection(projection);
        args.setDiscoveryProjection(discoveryProjection);
        args.setInstance(instance);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_unregisterInstance();
      }
    }

    public void updateInstance(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      updateInstance_call method_call = new updateInstance_call(projection, discoveryProjection, instance, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class updateInstance_call extends org.apache.thrift.async.TAsyncMethodCall {
      private CuratorProjection projection;
      private DiscoveryProjection discoveryProjection;
      private DiscoveryInstance instance;
      public updateInstance_call(CuratorProjection projection, DiscoveryProjection discoveryProjection, DiscoveryInstance instance, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.projection = projection;
        this.discoveryProjection = discoveryProjection;
        this.instance = instance;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("updateInstance", org.apache.thrift.protocol.TMessageType.CALL, 0));
        updateInstance_args args = new updateInstance_args();
        args.setProjection(projection);
        args.setDiscoveryProjection(discoveryProjection);
        args.setInstance(instance);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws CuratorException, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_updateInstance();
      }
    }

  }

  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      processMap.put("queryForInstance", new queryForInstance());
      processMap.put("queryForInstances", new queryForInstances());
      processMap.put("queryForNames", new queryForNames());
      processMap.put("registerInstance", new registerInstance());
      processMap.put("unregisterInstance", new unregisterInstance());
      processMap.put("updateInstance", new updateInstance());
      return processMap;
    }

    public static class queryForInstance<I extends Iface> extends org.apache.thrift.ProcessFunction<I, queryForInstance_args> {
      public queryForInstance() {
        super("queryForInstance");
      }

      public queryForInstance_args getEmptyArgsInstance() {
        return new queryForInstance_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public queryForInstance_result getResult(I iface, queryForInstance_args args) throws org.apache.thrift.TException {
        queryForInstance_result result = new queryForInstance_result();
        try {
          result.success = iface.queryForInstance(args.projection, args.discoveryProjection, args.name, args.id);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class queryForInstances<I extends Iface> extends org.apache.thrift.ProcessFunction<I, queryForInstances_args> {
      public queryForInstances() {
        super("queryForInstances");
      }

      public queryForInstances_args getEmptyArgsInstance() {
        return new queryForInstances_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public queryForInstances_result getResult(I iface, queryForInstances_args args) throws org.apache.thrift.TException {
        queryForInstances_result result = new queryForInstances_result();
        try {
          result.success = iface.queryForInstances(args.projection, args.discoveryProjection, args.name);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class queryForNames<I extends Iface> extends org.apache.thrift.ProcessFunction<I, queryForNames_args> {
      public queryForNames() {
        super("queryForNames");
      }

      public queryForNames_args getEmptyArgsInstance() {
        return new queryForNames_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public queryForNames_result getResult(I iface, queryForNames_args args) throws org.apache.thrift.TException {
        queryForNames_result result = new queryForNames_result();
        try {
          result.success = iface.queryForNames(args.projection, args.discoveryProjection);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class registerInstance<I extends Iface> extends org.apache.thrift.ProcessFunction<I, registerInstance_args> {
      public registerInstance() {
        super("registerInstance");
      }

      public registerInstance_args getEmptyArgsInstance() {
        return new registerInstance_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public registerInstance_result getResult(I iface, registerInstance_args args) throws org.apache.thrift.TException {
        registerInstance_result result = new registerInstance_result();
        try {
          iface.registerInstance(args.projection, args.discoveryProjection, args.instance);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class unregisterInstance<I extends Iface> extends org.apache.thrift.ProcessFunction<I, unregisterInstance_args> {
      public unregisterInstance() {
        super("unregisterInstance");
      }

      public unregisterInstance_args getEmptyArgsInstance() {
        return new unregisterInstance_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public unregisterInstance_result getResult(I iface, unregisterInstance_args args) throws org.apache.thrift.TException {
        unregisterInstance_result result = new unregisterInstance_result();
        try {
          iface.unregisterInstance(args.projection, args.discoveryProjection, args.instance);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

    public static class updateInstance<I extends Iface> extends org.apache.thrift.ProcessFunction<I, updateInstance_args> {
      public updateInstance() {
        super("updateInstance");
      }

      public updateInstance_args getEmptyArgsInstance() {
        return new updateInstance_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public updateInstance_result getResult(I iface, updateInstance_args args) throws org.apache.thrift.TException {
        updateInstance_result result = new updateInstance_result();
        try {
          iface.updateInstance(args.projection, args.discoveryProjection, args.instance);
        } catch (CuratorException ex1) {
          result.ex1 = ex1;
        }
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("queryForInstance", new queryForInstance());
      processMap.put("queryForInstances", new queryForInstances());
      processMap.put("queryForNames", new queryForNames());
      processMap.put("registerInstance", new registerInstance());
      processMap.put("unregisterInstance", new unregisterInstance());
      processMap.put("updateInstance", new updateInstance());
      return processMap;
    }

    public static class queryForInstance<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, queryForInstance_args, DiscoveryInstance> {
      public queryForInstance() {
        super("queryForInstance");
      }

      public queryForInstance_args getEmptyArgsInstance() {
        return new queryForInstance_args();
      }

      public AsyncMethodCallback<DiscoveryInstance> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<DiscoveryInstance>() { 
          public void onComplete(DiscoveryInstance o) {
            queryForInstance_result result = new queryForInstance_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.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 = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            queryForInstance_result result = new queryForInstance_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.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, queryForInstance_args args, org.apache.thrift.async.AsyncMethodCallback<DiscoveryInstance> resultHandler) throws TException {
        iface.queryForInstance(args.projection, args.discoveryProjection, args.name, args.id,resultHandler);
      }
    }

    public static class queryForInstances<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, queryForInstances_args, List<DiscoveryInstance>> {
      public queryForInstances() {
        super("queryForInstances");
      }

      public queryForInstances_args getEmptyArgsInstance() {
        return new queryForInstances_args();
      }

      public AsyncMethodCallback<List<DiscoveryInstance>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<List<DiscoveryInstance>>() { 
          public void onComplete(List<DiscoveryInstance> o) {
            queryForInstances_result result = new queryForInstances_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.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 = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            queryForInstances_result result = new queryForInstances_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.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, queryForInstances_args args, org.apache.thrift.async.AsyncMethodCallback<List<DiscoveryInstance>> resultHandler) throws TException {
        iface.queryForInstances(args.projection, args.discoveryProjection, args.name,resultHandler);
      }
    }

    public static class queryForNames<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, queryForNames_args, List<String>> {
      public queryForNames() {
        super("queryForNames");
      }

      public queryForNames_args getEmptyArgsInstance() {
        return new queryForNames_args();
      }

      public AsyncMethodCallback<List<String>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<List<String>>() { 
          public void onComplete(List<String> o) {
            queryForNames_result result = new queryForNames_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.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 = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            queryForNames_result result = new queryForNames_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.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, queryForNames_args args, org.apache.thrift.async.AsyncMethodCallback<List<String>> resultHandler) throws TException {
        iface.queryForNames(args.projection, args.discoveryProjection,resultHandler);
      }
    }

    public static class registerInstance<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, registerInstance_args, Void> {
      public registerInstance() {
        super("registerInstance");
      }

      public registerInstance_args getEmptyArgsInstance() {
        return new registerInstance_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            registerInstance_result result = new registerInstance_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.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 = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            registerInstance_result result = new registerInstance_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.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, registerInstance_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.registerInstance(args.projection, args.discoveryProjection, args.instance,resultHandler);
      }
    }

    public static class unregisterInstance<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, unregisterInstance_args, Void> {
      public unregisterInstance() {
        super("unregisterInstance");
      }

      public unregisterInstance_args getEmptyArgsInstance() {
        return new unregisterInstance_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            unregisterInstance_result result = new unregisterInstance_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.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 = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            unregisterInstance_result result = new unregisterInstance_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.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, unregisterInstance_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.unregisterInstance(args.projection, args.discoveryProjection, args.instance,resultHandler);
      }
    }

    public static class updateInstance<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, updateInstance_args, Void> {
      public updateInstance() {
        super("updateInstance");
      }

      public updateInstance_args getEmptyArgsInstance() {
        return new updateInstance_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            updateInstance_result result = new updateInstance_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.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 = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            updateInstance_result result = new updateInstance_result();
            if (e instanceof CuratorException) {
                        result.ex1 = (CuratorException) e;
                        result.setEx1IsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.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, updateInstance_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.updateInstance(args.projection, args.discoveryProjection, args.instance,resultHandler);
      }
    }

  }

  public static class queryForInstance_args implements org.apache.thrift.TBase<queryForInstance_args, queryForInstance_args._Fields>, java.io.Serializable, Cloneable, Comparable<queryForInstance_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("queryForInstance_args");

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField DISCOVERY_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("discoveryProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)3);
    private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)4);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new queryForInstance_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new queryForInstance_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProjection discoveryProjection; // required
    public String name; // required
    public String id; // 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 {
      PROJECTION((short)1, "projection"),
      DISCOVERY_PROJECTION((short)2, "discoveryProjection"),
      NAME((short)3, "name"),
      ID((short)4, "id");

      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: // PROJECTION
            return PROJECTION;
          case 2: // DISCOVERY_PROJECTION
            return DISCOVERY_PROJECTION;
          case 3: // NAME
            return NAME;
          case 4: // ID
            return ID;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.DISCOVERY_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("discoveryProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProjection.class)));
      tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queryForInstance_args.class, metaDataMap);
    }

    public queryForInstance_args() {
    }

    public queryForInstance_args(
      CuratorProjection projection,
      DiscoveryProjection discoveryProjection,
      String name,
      String id)
    {
      this();
      this.projection = projection;
      this.discoveryProjection = discoveryProjection;
      this.name = name;
      this.id = id;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public queryForInstance_args(queryForInstance_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetDiscoveryProjection()) {
        this.discoveryProjection = new DiscoveryProjection(other.discoveryProjection);
      }
      if (other.isSetName()) {
        this.name = other.name;
      }
      if (other.isSetId()) {
        this.id = other.id;
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.discoveryProjection = null;
      this.name = null;
      this.id = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public queryForInstance_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProjection getDiscoveryProjection() {
      return this.discoveryProjection;
    }

    public queryForInstance_args setDiscoveryProjection(DiscoveryProjection discoveryProjection) {
      this.discoveryProjection = discoveryProjection;
      return this;
    }

    public void unsetDiscoveryProjection() {
      this.discoveryProjection = null;
    }

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

    public void setDiscoveryProjectionIsSet(boolean value) {
      if (!value) {
        this.discoveryProjection = null;
      }
    }

    public String getName() {
      return this.name;
    }

    public queryForInstance_args setName(String name) {
      this.name = name;
      return this;
    }

    public void unsetName() {
      this.name = null;
    }

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

    public void setNameIsSet(boolean value) {
      if (!value) {
        this.name = null;
      }
    }

    public String getId() {
      return this.id;
    }

    public queryForInstance_args setId(String id) {
      this.id = id;
      return this;
    }

    public void unsetId() {
      this.id = null;
    }

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

    public void setIdIsSet(boolean value) {
      if (!value) {
        this.id = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case DISCOVERY_PROJECTION:
        if (value == null) {
          unsetDiscoveryProjection();
        } else {
          setDiscoveryProjection((DiscoveryProjection)value);
        }
        break;

      case NAME:
        if (value == null) {
          unsetName();
        } else {
          setName((String)value);
        }
        break;

      case ID:
        if (value == null) {
          unsetId();
        } else {
          setId((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case DISCOVERY_PROJECTION:
        return getDiscoveryProjection();

      case NAME:
        return getName();

      case ID:
        return getId();

      }
      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 PROJECTION:
        return isSetProjection();
      case DISCOVERY_PROJECTION:
        return isSetDiscoveryProjection();
      case NAME:
        return isSetName();
      case ID:
        return isSetId();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_discoveryProjection = true && this.isSetDiscoveryProjection();
      boolean that_present_discoveryProjection = true && that.isSetDiscoveryProjection();
      if (this_present_discoveryProjection || that_present_discoveryProjection) {
        if (!(this_present_discoveryProjection && that_present_discoveryProjection))
          return false;
        if (!this.discoveryProjection.equals(that.discoveryProjection))
          return false;
      }

      boolean this_present_name = true && this.isSetName();
      boolean that_present_name = true && that.isSetName();
      if (this_present_name || that_present_name) {
        if (!(this_present_name && that_present_name))
          return false;
        if (!this.name.equals(that.name))
          return false;
      }

      boolean this_present_id = true && this.isSetId();
      boolean that_present_id = true && that.isSetId();
      if (this_present_id || that_present_id) {
        if (!(this_present_id && that_present_id))
          return false;
        if (!this.id.equals(that.id))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDiscoveryProjection()).compareTo(other.isSetDiscoveryProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDiscoveryProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discoveryProjection, other.discoveryProjection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetName()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
        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("queryForInstance_args(");
      boolean first = true;

      sb.append("projection:");
      if (this.projection == null) {
        sb.append("null");
      } else {
        sb.append(this.projection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("discoveryProjection:");
      if (this.discoveryProjection == null) {
        sb.append("null");
      } else {
        sb.append(this.discoveryProjection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("name:");
      if (this.name == null) {
        sb.append("null");
      } else {
        sb.append(this.name);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("id:");
      if (this.id == null) {
        sb.append("null");
      } else {
        sb.append(this.id);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (projection != null) {
        projection.validate();
      }
      if (discoveryProjection != null) {
        discoveryProjection.validate();
      }
    }

    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 queryForInstance_argsStandardSchemeFactory implements SchemeFactory {
      public queryForInstance_argsStandardScheme getScheme() {
        return new queryForInstance_argsStandardScheme();
      }
    }

    private static class queryForInstance_argsStandardScheme extends StandardScheme<queryForInstance_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, queryForInstance_args 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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // DISCOVERY_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.discoveryProjection = new DiscoveryProjection();
                struct.discoveryProjection.read(iprot);
                struct.setDiscoveryProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // NAME
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.name = iprot.readString();
                struct.setNameIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 4: // ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.id = iprot.readString();
                struct.setIdIsSet(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, queryForInstance_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.discoveryProjection != null) {
          oprot.writeFieldBegin(DISCOVERY_PROJECTION_FIELD_DESC);
          struct.discoveryProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.name != null) {
          oprot.writeFieldBegin(NAME_FIELD_DESC);
          oprot.writeString(struct.name);
          oprot.writeFieldEnd();
        }
        if (struct.id != null) {
          oprot.writeFieldBegin(ID_FIELD_DESC);
          oprot.writeString(struct.id);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class queryForInstance_argsTupleSchemeFactory implements SchemeFactory {
      public queryForInstance_argsTupleScheme getScheme() {
        return new queryForInstance_argsTupleScheme();
      }
    }

    private static class queryForInstance_argsTupleScheme extends TupleScheme<queryForInstance_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, queryForInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetDiscoveryProjection()) {
          optionals.set(1);
        }
        if (struct.isSetName()) {
          optionals.set(2);
        }
        if (struct.isSetId()) {
          optionals.set(3);
        }
        oprot.writeBitSet(optionals, 4);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetDiscoveryProjection()) {
          struct.discoveryProjection.write(oprot);
        }
        if (struct.isSetName()) {
          oprot.writeString(struct.name);
        }
        if (struct.isSetId()) {
          oprot.writeString(struct.id);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, queryForInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(4);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.discoveryProjection = new DiscoveryProjection();
          struct.discoveryProjection.read(iprot);
          struct.setDiscoveryProjectionIsSet(true);
        }
        if (incoming.get(2)) {
          struct.name = iprot.readString();
          struct.setNameIsSet(true);
        }
        if (incoming.get(3)) {
          struct.id = iprot.readString();
          struct.setIdIsSet(true);
        }
      }
    }

  }

  public static class queryForInstance_result implements org.apache.thrift.TBase<queryForInstance_result, queryForInstance_result._Fields>, java.io.Serializable, Cloneable, Comparable<queryForInstance_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("queryForInstance_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.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 queryForInstance_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new queryForInstance_resultTupleSchemeFactory());
    }

    public DiscoveryInstance success; // required
    public CuratorException ex1; // 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 {
      SUCCESS((short)0, "success"),
      EX1((short)1, "ex1");

      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: // EX1
            return EX1;
          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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryInstance.class)));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queryForInstance_result.class, metaDataMap);
    }

    public queryForInstance_result() {
    }

    public queryForInstance_result(
      DiscoveryInstance success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public queryForInstance_result(queryForInstance_result other) {
      if (other.isSetSuccess()) {
        this.success = new DiscoveryInstance(other.success);
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.ex1 = null;
    }

    public DiscoveryInstance getSuccess() {
      return this.success;
    }

    public queryForInstance_result setSuccess(DiscoveryInstance 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 CuratorException getEx1() {
      return this.ex1;
    }

    public queryForInstance_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((DiscoveryInstance)value);
        }
        break;

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(queryForInstance_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(queryForInstance_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 = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("queryForInstance_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (success != null) {
        success.validate();
      }
    }

    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 queryForInstance_resultStandardSchemeFactory implements SchemeFactory {
      public queryForInstance_resultStandardScheme getScheme() {
        return new queryForInstance_resultStandardScheme();
      }
    }

    private static class queryForInstance_resultStandardScheme extends StandardScheme<queryForInstance_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, queryForInstance_result 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 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.success = new DiscoveryInstance();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, queryForInstance_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          struct.success.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class queryForInstance_resultTupleSchemeFactory implements SchemeFactory {
      public queryForInstance_resultTupleScheme getScheme() {
        return new queryForInstance_resultTupleScheme();
      }
    }

    private static class queryForInstance_resultTupleScheme extends TupleScheme<queryForInstance_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, queryForInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetEx1()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          struct.success.write(oprot);
        }
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, queryForInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = new DiscoveryInstance();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

  public static class queryForInstances_args implements org.apache.thrift.TBase<queryForInstances_args, queryForInstances_args._Fields>, java.io.Serializable, Cloneable, Comparable<queryForInstances_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("queryForInstances_args");

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField DISCOVERY_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("discoveryProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new queryForInstances_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new queryForInstances_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProjection discoveryProjection; // required
    public String name; // 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 {
      PROJECTION((short)1, "projection"),
      DISCOVERY_PROJECTION((short)2, "discoveryProjection"),
      NAME((short)3, "name");

      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: // PROJECTION
            return PROJECTION;
          case 2: // DISCOVERY_PROJECTION
            return DISCOVERY_PROJECTION;
          case 3: // NAME
            return NAME;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.DISCOVERY_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("discoveryProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProjection.class)));
      tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queryForInstances_args.class, metaDataMap);
    }

    public queryForInstances_args() {
    }

    public queryForInstances_args(
      CuratorProjection projection,
      DiscoveryProjection discoveryProjection,
      String name)
    {
      this();
      this.projection = projection;
      this.discoveryProjection = discoveryProjection;
      this.name = name;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public queryForInstances_args(queryForInstances_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetDiscoveryProjection()) {
        this.discoveryProjection = new DiscoveryProjection(other.discoveryProjection);
      }
      if (other.isSetName()) {
        this.name = other.name;
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.discoveryProjection = null;
      this.name = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public queryForInstances_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProjection getDiscoveryProjection() {
      return this.discoveryProjection;
    }

    public queryForInstances_args setDiscoveryProjection(DiscoveryProjection discoveryProjection) {
      this.discoveryProjection = discoveryProjection;
      return this;
    }

    public void unsetDiscoveryProjection() {
      this.discoveryProjection = null;
    }

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

    public void setDiscoveryProjectionIsSet(boolean value) {
      if (!value) {
        this.discoveryProjection = null;
      }
    }

    public String getName() {
      return this.name;
    }

    public queryForInstances_args setName(String name) {
      this.name = name;
      return this;
    }

    public void unsetName() {
      this.name = null;
    }

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

    public void setNameIsSet(boolean value) {
      if (!value) {
        this.name = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case DISCOVERY_PROJECTION:
        if (value == null) {
          unsetDiscoveryProjection();
        } else {
          setDiscoveryProjection((DiscoveryProjection)value);
        }
        break;

      case NAME:
        if (value == null) {
          unsetName();
        } else {
          setName((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case DISCOVERY_PROJECTION:
        return getDiscoveryProjection();

      case NAME:
        return getName();

      }
      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 PROJECTION:
        return isSetProjection();
      case DISCOVERY_PROJECTION:
        return isSetDiscoveryProjection();
      case NAME:
        return isSetName();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_discoveryProjection = true && this.isSetDiscoveryProjection();
      boolean that_present_discoveryProjection = true && that.isSetDiscoveryProjection();
      if (this_present_discoveryProjection || that_present_discoveryProjection) {
        if (!(this_present_discoveryProjection && that_present_discoveryProjection))
          return false;
        if (!this.discoveryProjection.equals(that.discoveryProjection))
          return false;
      }

      boolean this_present_name = true && this.isSetName();
      boolean that_present_name = true && that.isSetName();
      if (this_present_name || that_present_name) {
        if (!(this_present_name && that_present_name))
          return false;
        if (!this.name.equals(that.name))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDiscoveryProjection()).compareTo(other.isSetDiscoveryProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDiscoveryProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discoveryProjection, other.discoveryProjection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetName()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
        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("queryForInstances_args(");
      boolean first = true;

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

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (projection != null) {
        projection.validate();
      }
      if (discoveryProjection != null) {
        discoveryProjection.validate();
      }
    }

    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 queryForInstances_argsStandardSchemeFactory implements SchemeFactory {
      public queryForInstances_argsStandardScheme getScheme() {
        return new queryForInstances_argsStandardScheme();
      }
    }

    private static class queryForInstances_argsStandardScheme extends StandardScheme<queryForInstances_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, queryForInstances_args 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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // DISCOVERY_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.discoveryProjection = new DiscoveryProjection();
                struct.discoveryProjection.read(iprot);
                struct.setDiscoveryProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // NAME
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.name = iprot.readString();
                struct.setNameIsSet(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, queryForInstances_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.discoveryProjection != null) {
          oprot.writeFieldBegin(DISCOVERY_PROJECTION_FIELD_DESC);
          struct.discoveryProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.name != null) {
          oprot.writeFieldBegin(NAME_FIELD_DESC);
          oprot.writeString(struct.name);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class queryForInstances_argsTupleSchemeFactory implements SchemeFactory {
      public queryForInstances_argsTupleScheme getScheme() {
        return new queryForInstances_argsTupleScheme();
      }
    }

    private static class queryForInstances_argsTupleScheme extends TupleScheme<queryForInstances_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, queryForInstances_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetDiscoveryProjection()) {
          optionals.set(1);
        }
        if (struct.isSetName()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetDiscoveryProjection()) {
          struct.discoveryProjection.write(oprot);
        }
        if (struct.isSetName()) {
          oprot.writeString(struct.name);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, queryForInstances_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.discoveryProjection = new DiscoveryProjection();
          struct.discoveryProjection.read(iprot);
          struct.setDiscoveryProjectionIsSet(true);
        }
        if (incoming.get(2)) {
          struct.name = iprot.readString();
          struct.setNameIsSet(true);
        }
      }
    }

  }

  public static class queryForInstances_result implements org.apache.thrift.TBase<queryForInstances_result, queryForInstances_result._Fields>, java.io.Serializable, Cloneable, Comparable<queryForInstances_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("queryForInstances_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.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 queryForInstances_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new queryForInstances_resultTupleSchemeFactory());
    }

    public List<DiscoveryInstance> success; // required
    public CuratorException ex1; // 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 {
      SUCCESS((short)0, "success"),
      EX1((short)1, "ex1");

      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: // EX1
            return EX1;
          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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryInstance.class))));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queryForInstances_result.class, metaDataMap);
    }

    public queryForInstances_result() {
    }

    public queryForInstances_result(
      List<DiscoveryInstance> success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public queryForInstances_result(queryForInstances_result other) {
      if (other.isSetSuccess()) {
        List<DiscoveryInstance> __this__success = new ArrayList<DiscoveryInstance>(other.success.size());
        for (DiscoveryInstance other_element : other.success) {
          __this__success.add(new DiscoveryInstance(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.ex1 = null;
    }

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

    public java.util.Iterator<DiscoveryInstance> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(DiscoveryInstance elem) {
      if (this.success == null) {
        this.success = new ArrayList<DiscoveryInstance>();
      }
      this.success.add(elem);
    }

    public List<DiscoveryInstance> getSuccess() {
      return this.success;
    }

    public queryForInstances_result setSuccess(List<DiscoveryInstance> 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 CuratorException getEx1() {
      return this.ex1;
    }

    public queryForInstances_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<DiscoveryInstance>)value);
        }
        break;

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(queryForInstances_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(queryForInstances_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 = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("queryForInstances_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // 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 queryForInstances_resultStandardSchemeFactory implements SchemeFactory {
      public queryForInstances_resultStandardScheme getScheme() {
        return new queryForInstances_resultStandardScheme();
      }
    }

    private static class queryForInstances_resultStandardScheme extends StandardScheme<queryForInstances_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, queryForInstances_result 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 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list56 = iprot.readListBegin();
                  struct.success = new ArrayList<DiscoveryInstance>(_list56.size);
                  for (int _i57 = 0; _i57 < _list56.size; ++_i57)
                  {
                    DiscoveryInstance _elem58;
                    _elem58 = new DiscoveryInstance();
                    _elem58.read(iprot);
                    struct.success.add(_elem58);
                  }
                  iprot.readListEnd();
                }
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, queryForInstances_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
            for (DiscoveryInstance _iter59 : struct.success)
            {
              _iter59.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class queryForInstances_resultTupleSchemeFactory implements SchemeFactory {
      public queryForInstances_resultTupleScheme getScheme() {
        return new queryForInstances_resultTupleScheme();
      }
    }

    private static class queryForInstances_resultTupleScheme extends TupleScheme<queryForInstances_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, queryForInstances_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetEx1()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          {
            oprot.writeI32(struct.success.size());
            for (DiscoveryInstance _iter60 : struct.success)
            {
              _iter60.write(oprot);
            }
          }
        }
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, queryForInstances_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list61 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.success = new ArrayList<DiscoveryInstance>(_list61.size);
            for (int _i62 = 0; _i62 < _list61.size; ++_i62)
            {
              DiscoveryInstance _elem63;
              _elem63 = new DiscoveryInstance();
              _elem63.read(iprot);
              struct.success.add(_elem63);
            }
          }
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

  public static class queryForNames_args implements org.apache.thrift.TBase<queryForNames_args, queryForNames_args._Fields>, java.io.Serializable, Cloneable, Comparable<queryForNames_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("queryForNames_args");

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField DISCOVERY_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("discoveryProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new queryForNames_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new queryForNames_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProjection discoveryProjection; // 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 {
      PROJECTION((short)1, "projection"),
      DISCOVERY_PROJECTION((short)2, "discoveryProjection");

      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: // PROJECTION
            return PROJECTION;
          case 2: // DISCOVERY_PROJECTION
            return DISCOVERY_PROJECTION;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.DISCOVERY_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("discoveryProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProjection.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queryForNames_args.class, metaDataMap);
    }

    public queryForNames_args() {
    }

    public queryForNames_args(
      CuratorProjection projection,
      DiscoveryProjection discoveryProjection)
    {
      this();
      this.projection = projection;
      this.discoveryProjection = discoveryProjection;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public queryForNames_args(queryForNames_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetDiscoveryProjection()) {
        this.discoveryProjection = new DiscoveryProjection(other.discoveryProjection);
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.discoveryProjection = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public queryForNames_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProjection getDiscoveryProjection() {
      return this.discoveryProjection;
    }

    public queryForNames_args setDiscoveryProjection(DiscoveryProjection discoveryProjection) {
      this.discoveryProjection = discoveryProjection;
      return this;
    }

    public void unsetDiscoveryProjection() {
      this.discoveryProjection = null;
    }

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

    public void setDiscoveryProjectionIsSet(boolean value) {
      if (!value) {
        this.discoveryProjection = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case DISCOVERY_PROJECTION:
        if (value == null) {
          unsetDiscoveryProjection();
        } else {
          setDiscoveryProjection((DiscoveryProjection)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case DISCOVERY_PROJECTION:
        return getDiscoveryProjection();

      }
      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 PROJECTION:
        return isSetProjection();
      case DISCOVERY_PROJECTION:
        return isSetDiscoveryProjection();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_discoveryProjection = true && this.isSetDiscoveryProjection();
      boolean that_present_discoveryProjection = true && that.isSetDiscoveryProjection();
      if (this_present_discoveryProjection || that_present_discoveryProjection) {
        if (!(this_present_discoveryProjection && that_present_discoveryProjection))
          return false;
        if (!this.discoveryProjection.equals(that.discoveryProjection))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDiscoveryProjection()).compareTo(other.isSetDiscoveryProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDiscoveryProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discoveryProjection, other.discoveryProjection);
        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("queryForNames_args(");
      boolean first = true;

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

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (projection != null) {
        projection.validate();
      }
      if (discoveryProjection != null) {
        discoveryProjection.validate();
      }
    }

    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 queryForNames_argsStandardSchemeFactory implements SchemeFactory {
      public queryForNames_argsStandardScheme getScheme() {
        return new queryForNames_argsStandardScheme();
      }
    }

    private static class queryForNames_argsStandardScheme extends StandardScheme<queryForNames_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, queryForNames_args 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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // DISCOVERY_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.discoveryProjection = new DiscoveryProjection();
                struct.discoveryProjection.read(iprot);
                struct.setDiscoveryProjectionIsSet(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, queryForNames_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.discoveryProjection != null) {
          oprot.writeFieldBegin(DISCOVERY_PROJECTION_FIELD_DESC);
          struct.discoveryProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class queryForNames_argsTupleSchemeFactory implements SchemeFactory {
      public queryForNames_argsTupleScheme getScheme() {
        return new queryForNames_argsTupleScheme();
      }
    }

    private static class queryForNames_argsTupleScheme extends TupleScheme<queryForNames_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, queryForNames_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetDiscoveryProjection()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetDiscoveryProjection()) {
          struct.discoveryProjection.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, queryForNames_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.discoveryProjection = new DiscoveryProjection();
          struct.discoveryProjection.read(iprot);
          struct.setDiscoveryProjectionIsSet(true);
        }
      }
    }

  }

  public static class queryForNames_result implements org.apache.thrift.TBase<queryForNames_result, queryForNames_result._Fields>, java.io.Serializable, Cloneable, Comparable<queryForNames_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("queryForNames_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.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 queryForNames_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new queryForNames_resultTupleSchemeFactory());
    }

    public List<String> success; // required
    public CuratorException ex1; // 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 {
      SUCCESS((short)0, "success"),
      EX1((short)1, "ex1");

      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: // EX1
            return EX1;
          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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          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))));
      tmpMap.put(_Fields.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queryForNames_result.class, metaDataMap);
    }

    public queryForNames_result() {
    }

    public queryForNames_result(
      List<String> success,
      CuratorException ex1)
    {
      this();
      this.success = success;
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public queryForNames_result(queryForNames_result other) {
      if (other.isSetSuccess()) {
        List<String> __this__success = new ArrayList<String>(other.success);
        this.success = __this__success;
      }
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

    @Override
    public void clear() {
      this.success = null;
      this.ex1 = null;
    }

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

    public java.util.Iterator<String> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(String elem) {
      if (this.success == null) {
        this.success = new ArrayList<String>();
      }
      this.success.add(elem);
    }

    public List<String> getSuccess() {
      return this.success;
    }

    public queryForNames_result setSuccess(List<String> 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 CuratorException getEx1() {
      return this.ex1;
    }

    public queryForNames_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<String>)value);
        }
        break;

      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

    public boolean equals(queryForNames_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_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

    @Override
    public int compareTo(queryForNames_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 = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("queryForNames_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("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // 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 queryForNames_resultStandardSchemeFactory implements SchemeFactory {
      public queryForNames_resultStandardScheme getScheme() {
        return new queryForNames_resultStandardScheme();
      }
    }

    private static class queryForNames_resultStandardScheme extends StandardScheme<queryForNames_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, queryForNames_result 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 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list64 = iprot.readListBegin();
                  struct.success = new ArrayList<String>(_list64.size);
                  for (int _i65 = 0; _i65 < _list64.size; ++_i65)
                  {
                    String _elem66;
                    _elem66 = iprot.readString();
                    struct.success.add(_elem66);
                  }
                  iprot.readListEnd();
                }
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, queryForNames_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size()));
            for (String _iter67 : struct.success)
            {
              oprot.writeString(_iter67);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class queryForNames_resultTupleSchemeFactory implements SchemeFactory {
      public queryForNames_resultTupleScheme getScheme() {
        return new queryForNames_resultTupleScheme();
      }
    }

    private static class queryForNames_resultTupleScheme extends TupleScheme<queryForNames_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, queryForNames_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetEx1()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          {
            oprot.writeI32(struct.success.size());
            for (String _iter68 : struct.success)
            {
              oprot.writeString(_iter68);
            }
          }
        }
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, queryForNames_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
            struct.success = new ArrayList<String>(_list69.size);
            for (int _i70 = 0; _i70 < _list69.size; ++_i70)
            {
              String _elem71;
              _elem71 = iprot.readString();
              struct.success.add(_elem71);
            }
          }
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

  public static class registerInstance_args implements org.apache.thrift.TBase<registerInstance_args, registerInstance_args._Fields>, java.io.Serializable, Cloneable, Comparable<registerInstance_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("registerInstance_args");

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField DISCOVERY_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("discoveryProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField INSTANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("instance", org.apache.thrift.protocol.TType.STRUCT, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new registerInstance_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new registerInstance_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProjection discoveryProjection; // required
    public DiscoveryInstance instance; // 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 {
      PROJECTION((short)1, "projection"),
      DISCOVERY_PROJECTION((short)2, "discoveryProjection"),
      INSTANCE((short)3, "instance");

      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: // PROJECTION
            return PROJECTION;
          case 2: // DISCOVERY_PROJECTION
            return DISCOVERY_PROJECTION;
          case 3: // INSTANCE
            return INSTANCE;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.DISCOVERY_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("discoveryProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProjection.class)));
      tmpMap.put(_Fields.INSTANCE, new org.apache.thrift.meta_data.FieldMetaData("instance", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryInstance.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(registerInstance_args.class, metaDataMap);
    }

    public registerInstance_args() {
    }

    public registerInstance_args(
      CuratorProjection projection,
      DiscoveryProjection discoveryProjection,
      DiscoveryInstance instance)
    {
      this();
      this.projection = projection;
      this.discoveryProjection = discoveryProjection;
      this.instance = instance;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public registerInstance_args(registerInstance_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetDiscoveryProjection()) {
        this.discoveryProjection = new DiscoveryProjection(other.discoveryProjection);
      }
      if (other.isSetInstance()) {
        this.instance = new DiscoveryInstance(other.instance);
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.discoveryProjection = null;
      this.instance = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public registerInstance_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProjection getDiscoveryProjection() {
      return this.discoveryProjection;
    }

    public registerInstance_args setDiscoveryProjection(DiscoveryProjection discoveryProjection) {
      this.discoveryProjection = discoveryProjection;
      return this;
    }

    public void unsetDiscoveryProjection() {
      this.discoveryProjection = null;
    }

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

    public void setDiscoveryProjectionIsSet(boolean value) {
      if (!value) {
        this.discoveryProjection = null;
      }
    }

    public DiscoveryInstance getInstance() {
      return this.instance;
    }

    public registerInstance_args setInstance(DiscoveryInstance instance) {
      this.instance = instance;
      return this;
    }

    public void unsetInstance() {
      this.instance = null;
    }

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

    public void setInstanceIsSet(boolean value) {
      if (!value) {
        this.instance = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case DISCOVERY_PROJECTION:
        if (value == null) {
          unsetDiscoveryProjection();
        } else {
          setDiscoveryProjection((DiscoveryProjection)value);
        }
        break;

      case INSTANCE:
        if (value == null) {
          unsetInstance();
        } else {
          setInstance((DiscoveryInstance)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case DISCOVERY_PROJECTION:
        return getDiscoveryProjection();

      case INSTANCE:
        return getInstance();

      }
      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 PROJECTION:
        return isSetProjection();
      case DISCOVERY_PROJECTION:
        return isSetDiscoveryProjection();
      case INSTANCE:
        return isSetInstance();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_discoveryProjection = true && this.isSetDiscoveryProjection();
      boolean that_present_discoveryProjection = true && that.isSetDiscoveryProjection();
      if (this_present_discoveryProjection || that_present_discoveryProjection) {
        if (!(this_present_discoveryProjection && that_present_discoveryProjection))
          return false;
        if (!this.discoveryProjection.equals(that.discoveryProjection))
          return false;
      }

      boolean this_present_instance = true && this.isSetInstance();
      boolean that_present_instance = true && that.isSetInstance();
      if (this_present_instance || that_present_instance) {
        if (!(this_present_instance && that_present_instance))
          return false;
        if (!this.instance.equals(that.instance))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDiscoveryProjection()).compareTo(other.isSetDiscoveryProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDiscoveryProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discoveryProjection, other.discoveryProjection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetInstance()).compareTo(other.isSetInstance());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetInstance()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instance, other.instance);
        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("registerInstance_args(");
      boolean first = true;

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

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (projection != null) {
        projection.validate();
      }
      if (discoveryProjection != null) {
        discoveryProjection.validate();
      }
      if (instance != null) {
        instance.validate();
      }
    }

    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 registerInstance_argsStandardSchemeFactory implements SchemeFactory {
      public registerInstance_argsStandardScheme getScheme() {
        return new registerInstance_argsStandardScheme();
      }
    }

    private static class registerInstance_argsStandardScheme extends StandardScheme<registerInstance_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, registerInstance_args 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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // DISCOVERY_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.discoveryProjection = new DiscoveryProjection();
                struct.discoveryProjection.read(iprot);
                struct.setDiscoveryProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // INSTANCE
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.instance = new DiscoveryInstance();
                struct.instance.read(iprot);
                struct.setInstanceIsSet(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, registerInstance_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.discoveryProjection != null) {
          oprot.writeFieldBegin(DISCOVERY_PROJECTION_FIELD_DESC);
          struct.discoveryProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.instance != null) {
          oprot.writeFieldBegin(INSTANCE_FIELD_DESC);
          struct.instance.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class registerInstance_argsTupleSchemeFactory implements SchemeFactory {
      public registerInstance_argsTupleScheme getScheme() {
        return new registerInstance_argsTupleScheme();
      }
    }

    private static class registerInstance_argsTupleScheme extends TupleScheme<registerInstance_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, registerInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetDiscoveryProjection()) {
          optionals.set(1);
        }
        if (struct.isSetInstance()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetDiscoveryProjection()) {
          struct.discoveryProjection.write(oprot);
        }
        if (struct.isSetInstance()) {
          struct.instance.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, registerInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.discoveryProjection = new DiscoveryProjection();
          struct.discoveryProjection.read(iprot);
          struct.setDiscoveryProjectionIsSet(true);
        }
        if (incoming.get(2)) {
          struct.instance = new DiscoveryInstance();
          struct.instance.read(iprot);
          struct.setInstanceIsSet(true);
        }
      }
    }

  }

  public static class registerInstance_result implements org.apache.thrift.TBase<registerInstance_result, registerInstance_result._Fields>, java.io.Serializable, Cloneable, Comparable<registerInstance_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("registerInstance_result");

    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.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 registerInstance_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new registerInstance_resultTupleSchemeFactory());
    }

    public CuratorException ex1; // 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 {
      EX1((short)1, "ex1");

      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: // EX1
            return EX1;
          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.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(registerInstance_result.class, metaDataMap);
    }

    public registerInstance_result() {
    }

    public registerInstance_result(
      CuratorException ex1)
    {
      this();
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public registerInstance_result(registerInstance_result other) {
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

    public CuratorException getEx1() {
      return this.ex1;
    }

    public registerInstance_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("registerInstance_result(");
      boolean first = true;

      sb.append("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // 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 registerInstance_resultStandardSchemeFactory implements SchemeFactory {
      public registerInstance_resultStandardScheme getScheme() {
        return new registerInstance_resultStandardScheme();
      }
    }

    private static class registerInstance_resultStandardScheme extends StandardScheme<registerInstance_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, registerInstance_result 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: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, registerInstance_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class registerInstance_resultTupleSchemeFactory implements SchemeFactory {
      public registerInstance_resultTupleScheme getScheme() {
        return new registerInstance_resultTupleScheme();
      }
    }

    private static class registerInstance_resultTupleScheme extends TupleScheme<registerInstance_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, registerInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetEx1()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, registerInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

  public static class unregisterInstance_args implements org.apache.thrift.TBase<unregisterInstance_args, unregisterInstance_args._Fields>, java.io.Serializable, Cloneable, Comparable<unregisterInstance_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("unregisterInstance_args");

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField DISCOVERY_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("discoveryProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField INSTANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("instance", org.apache.thrift.protocol.TType.STRUCT, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new unregisterInstance_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new unregisterInstance_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProjection discoveryProjection; // required
    public DiscoveryInstance instance; // 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 {
      PROJECTION((short)1, "projection"),
      DISCOVERY_PROJECTION((short)2, "discoveryProjection"),
      INSTANCE((short)3, "instance");

      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: // PROJECTION
            return PROJECTION;
          case 2: // DISCOVERY_PROJECTION
            return DISCOVERY_PROJECTION;
          case 3: // INSTANCE
            return INSTANCE;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.DISCOVERY_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("discoveryProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProjection.class)));
      tmpMap.put(_Fields.INSTANCE, new org.apache.thrift.meta_data.FieldMetaData("instance", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryInstance.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(unregisterInstance_args.class, metaDataMap);
    }

    public unregisterInstance_args() {
    }

    public unregisterInstance_args(
      CuratorProjection projection,
      DiscoveryProjection discoveryProjection,
      DiscoveryInstance instance)
    {
      this();
      this.projection = projection;
      this.discoveryProjection = discoveryProjection;
      this.instance = instance;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public unregisterInstance_args(unregisterInstance_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetDiscoveryProjection()) {
        this.discoveryProjection = new DiscoveryProjection(other.discoveryProjection);
      }
      if (other.isSetInstance()) {
        this.instance = new DiscoveryInstance(other.instance);
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.discoveryProjection = null;
      this.instance = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public unregisterInstance_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProjection getDiscoveryProjection() {
      return this.discoveryProjection;
    }

    public unregisterInstance_args setDiscoveryProjection(DiscoveryProjection discoveryProjection) {
      this.discoveryProjection = discoveryProjection;
      return this;
    }

    public void unsetDiscoveryProjection() {
      this.discoveryProjection = null;
    }

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

    public void setDiscoveryProjectionIsSet(boolean value) {
      if (!value) {
        this.discoveryProjection = null;
      }
    }

    public DiscoveryInstance getInstance() {
      return this.instance;
    }

    public unregisterInstance_args setInstance(DiscoveryInstance instance) {
      this.instance = instance;
      return this;
    }

    public void unsetInstance() {
      this.instance = null;
    }

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

    public void setInstanceIsSet(boolean value) {
      if (!value) {
        this.instance = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case DISCOVERY_PROJECTION:
        if (value == null) {
          unsetDiscoveryProjection();
        } else {
          setDiscoveryProjection((DiscoveryProjection)value);
        }
        break;

      case INSTANCE:
        if (value == null) {
          unsetInstance();
        } else {
          setInstance((DiscoveryInstance)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case DISCOVERY_PROJECTION:
        return getDiscoveryProjection();

      case INSTANCE:
        return getInstance();

      }
      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 PROJECTION:
        return isSetProjection();
      case DISCOVERY_PROJECTION:
        return isSetDiscoveryProjection();
      case INSTANCE:
        return isSetInstance();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_discoveryProjection = true && this.isSetDiscoveryProjection();
      boolean that_present_discoveryProjection = true && that.isSetDiscoveryProjection();
      if (this_present_discoveryProjection || that_present_discoveryProjection) {
        if (!(this_present_discoveryProjection && that_present_discoveryProjection))
          return false;
        if (!this.discoveryProjection.equals(that.discoveryProjection))
          return false;
      }

      boolean this_present_instance = true && this.isSetInstance();
      boolean that_present_instance = true && that.isSetInstance();
      if (this_present_instance || that_present_instance) {
        if (!(this_present_instance && that_present_instance))
          return false;
        if (!this.instance.equals(that.instance))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDiscoveryProjection()).compareTo(other.isSetDiscoveryProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDiscoveryProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discoveryProjection, other.discoveryProjection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetInstance()).compareTo(other.isSetInstance());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetInstance()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instance, other.instance);
        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("unregisterInstance_args(");
      boolean first = true;

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

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (projection != null) {
        projection.validate();
      }
      if (discoveryProjection != null) {
        discoveryProjection.validate();
      }
      if (instance != null) {
        instance.validate();
      }
    }

    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 unregisterInstance_argsStandardSchemeFactory implements SchemeFactory {
      public unregisterInstance_argsStandardScheme getScheme() {
        return new unregisterInstance_argsStandardScheme();
      }
    }

    private static class unregisterInstance_argsStandardScheme extends StandardScheme<unregisterInstance_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, unregisterInstance_args 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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // DISCOVERY_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.discoveryProjection = new DiscoveryProjection();
                struct.discoveryProjection.read(iprot);
                struct.setDiscoveryProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // INSTANCE
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.instance = new DiscoveryInstance();
                struct.instance.read(iprot);
                struct.setInstanceIsSet(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, unregisterInstance_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.discoveryProjection != null) {
          oprot.writeFieldBegin(DISCOVERY_PROJECTION_FIELD_DESC);
          struct.discoveryProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.instance != null) {
          oprot.writeFieldBegin(INSTANCE_FIELD_DESC);
          struct.instance.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class unregisterInstance_argsTupleSchemeFactory implements SchemeFactory {
      public unregisterInstance_argsTupleScheme getScheme() {
        return new unregisterInstance_argsTupleScheme();
      }
    }

    private static class unregisterInstance_argsTupleScheme extends TupleScheme<unregisterInstance_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, unregisterInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetDiscoveryProjection()) {
          optionals.set(1);
        }
        if (struct.isSetInstance()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetDiscoveryProjection()) {
          struct.discoveryProjection.write(oprot);
        }
        if (struct.isSetInstance()) {
          struct.instance.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, unregisterInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.discoveryProjection = new DiscoveryProjection();
          struct.discoveryProjection.read(iprot);
          struct.setDiscoveryProjectionIsSet(true);
        }
        if (incoming.get(2)) {
          struct.instance = new DiscoveryInstance();
          struct.instance.read(iprot);
          struct.setInstanceIsSet(true);
        }
      }
    }

  }

  public static class unregisterInstance_result implements org.apache.thrift.TBase<unregisterInstance_result, unregisterInstance_result._Fields>, java.io.Serializable, Cloneable, Comparable<unregisterInstance_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("unregisterInstance_result");

    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.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 unregisterInstance_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new unregisterInstance_resultTupleSchemeFactory());
    }

    public CuratorException ex1; // 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 {
      EX1((short)1, "ex1");

      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: // EX1
            return EX1;
          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.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(unregisterInstance_result.class, metaDataMap);
    }

    public unregisterInstance_result() {
    }

    public unregisterInstance_result(
      CuratorException ex1)
    {
      this();
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public unregisterInstance_result(unregisterInstance_result other) {
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

    public CuratorException getEx1() {
      return this.ex1;
    }

    public unregisterInstance_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("unregisterInstance_result(");
      boolean first = true;

      sb.append("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // 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 unregisterInstance_resultStandardSchemeFactory implements SchemeFactory {
      public unregisterInstance_resultStandardScheme getScheme() {
        return new unregisterInstance_resultStandardScheme();
      }
    }

    private static class unregisterInstance_resultStandardScheme extends StandardScheme<unregisterInstance_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, unregisterInstance_result 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: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, unregisterInstance_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class unregisterInstance_resultTupleSchemeFactory implements SchemeFactory {
      public unregisterInstance_resultTupleScheme getScheme() {
        return new unregisterInstance_resultTupleScheme();
      }
    }

    private static class unregisterInstance_resultTupleScheme extends TupleScheme<unregisterInstance_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, unregisterInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetEx1()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, unregisterInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

  public static class updateInstance_args implements org.apache.thrift.TBase<updateInstance_args, updateInstance_args._Fields>, java.io.Serializable, Cloneable, Comparable<updateInstance_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateInstance_args");

    private static final org.apache.thrift.protocol.TField PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("projection", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField DISCOVERY_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("discoveryProjection", org.apache.thrift.protocol.TType.STRUCT, (short)2);
    private static final org.apache.thrift.protocol.TField INSTANCE_FIELD_DESC = new org.apache.thrift.protocol.TField("instance", org.apache.thrift.protocol.TType.STRUCT, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new updateInstance_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new updateInstance_argsTupleSchemeFactory());
    }

    public CuratorProjection projection; // required
    public DiscoveryProjection discoveryProjection; // required
    public DiscoveryInstance instance; // 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 {
      PROJECTION((short)1, "projection"),
      DISCOVERY_PROJECTION((short)2, "discoveryProjection"),
      INSTANCE((short)3, "instance");

      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: // PROJECTION
            return PROJECTION;
          case 2: // DISCOVERY_PROJECTION
            return DISCOVERY_PROJECTION;
          case 3: // INSTANCE
            return INSTANCE;
          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.PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("projection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CuratorProjection.class)));
      tmpMap.put(_Fields.DISCOVERY_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("discoveryProjection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryProjection.class)));
      tmpMap.put(_Fields.INSTANCE, new org.apache.thrift.meta_data.FieldMetaData("instance", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DiscoveryInstance.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateInstance_args.class, metaDataMap);
    }

    public updateInstance_args() {
    }

    public updateInstance_args(
      CuratorProjection projection,
      DiscoveryProjection discoveryProjection,
      DiscoveryInstance instance)
    {
      this();
      this.projection = projection;
      this.discoveryProjection = discoveryProjection;
      this.instance = instance;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public updateInstance_args(updateInstance_args other) {
      if (other.isSetProjection()) {
        this.projection = new CuratorProjection(other.projection);
      }
      if (other.isSetDiscoveryProjection()) {
        this.discoveryProjection = new DiscoveryProjection(other.discoveryProjection);
      }
      if (other.isSetInstance()) {
        this.instance = new DiscoveryInstance(other.instance);
      }
    }

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

    @Override
    public void clear() {
      this.projection = null;
      this.discoveryProjection = null;
      this.instance = null;
    }

    public CuratorProjection getProjection() {
      return this.projection;
    }

    public updateInstance_args setProjection(CuratorProjection projection) {
      this.projection = projection;
      return this;
    }

    public void unsetProjection() {
      this.projection = null;
    }

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

    public void setProjectionIsSet(boolean value) {
      if (!value) {
        this.projection = null;
      }
    }

    public DiscoveryProjection getDiscoveryProjection() {
      return this.discoveryProjection;
    }

    public updateInstance_args setDiscoveryProjection(DiscoveryProjection discoveryProjection) {
      this.discoveryProjection = discoveryProjection;
      return this;
    }

    public void unsetDiscoveryProjection() {
      this.discoveryProjection = null;
    }

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

    public void setDiscoveryProjectionIsSet(boolean value) {
      if (!value) {
        this.discoveryProjection = null;
      }
    }

    public DiscoveryInstance getInstance() {
      return this.instance;
    }

    public updateInstance_args setInstance(DiscoveryInstance instance) {
      this.instance = instance;
      return this;
    }

    public void unsetInstance() {
      this.instance = null;
    }

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

    public void setInstanceIsSet(boolean value) {
      if (!value) {
        this.instance = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PROJECTION:
        if (value == null) {
          unsetProjection();
        } else {
          setProjection((CuratorProjection)value);
        }
        break;

      case DISCOVERY_PROJECTION:
        if (value == null) {
          unsetDiscoveryProjection();
        } else {
          setDiscoveryProjection((DiscoveryProjection)value);
        }
        break;

      case INSTANCE:
        if (value == null) {
          unsetInstance();
        } else {
          setInstance((DiscoveryInstance)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PROJECTION:
        return getProjection();

      case DISCOVERY_PROJECTION:
        return getDiscoveryProjection();

      case INSTANCE:
        return getInstance();

      }
      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 PROJECTION:
        return isSetProjection();
      case DISCOVERY_PROJECTION:
        return isSetDiscoveryProjection();
      case INSTANCE:
        return isSetInstance();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_projection = true && this.isSetProjection();
      boolean that_present_projection = true && that.isSetProjection();
      if (this_present_projection || that_present_projection) {
        if (!(this_present_projection && that_present_projection))
          return false;
        if (!this.projection.equals(that.projection))
          return false;
      }

      boolean this_present_discoveryProjection = true && this.isSetDiscoveryProjection();
      boolean that_present_discoveryProjection = true && that.isSetDiscoveryProjection();
      if (this_present_discoveryProjection || that_present_discoveryProjection) {
        if (!(this_present_discoveryProjection && that_present_discoveryProjection))
          return false;
        if (!this.discoveryProjection.equals(that.discoveryProjection))
          return false;
      }

      boolean this_present_instance = true && this.isSetInstance();
      boolean that_present_instance = true && that.isSetInstance();
      if (this_present_instance || that_present_instance) {
        if (!(this_present_instance && that_present_instance))
          return false;
        if (!this.instance.equals(that.instance))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetProjection()).compareTo(other.isSetProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.projection, other.projection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetDiscoveryProjection()).compareTo(other.isSetDiscoveryProjection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetDiscoveryProjection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.discoveryProjection, other.discoveryProjection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetInstance()).compareTo(other.isSetInstance());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetInstance()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.instance, other.instance);
        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("updateInstance_args(");
      boolean first = true;

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

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (projection != null) {
        projection.validate();
      }
      if (discoveryProjection != null) {
        discoveryProjection.validate();
      }
      if (instance != null) {
        instance.validate();
      }
    }

    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 updateInstance_argsStandardSchemeFactory implements SchemeFactory {
      public updateInstance_argsStandardScheme getScheme() {
        return new updateInstance_argsStandardScheme();
      }
    }

    private static class updateInstance_argsStandardScheme extends StandardScheme<updateInstance_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, updateInstance_args 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: // PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.projection = new CuratorProjection();
                struct.projection.read(iprot);
                struct.setProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // DISCOVERY_PROJECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.discoveryProjection = new DiscoveryProjection();
                struct.discoveryProjection.read(iprot);
                struct.setDiscoveryProjectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // INSTANCE
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.instance = new DiscoveryInstance();
                struct.instance.read(iprot);
                struct.setInstanceIsSet(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, updateInstance_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.projection != null) {
          oprot.writeFieldBegin(PROJECTION_FIELD_DESC);
          struct.projection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.discoveryProjection != null) {
          oprot.writeFieldBegin(DISCOVERY_PROJECTION_FIELD_DESC);
          struct.discoveryProjection.write(oprot);
          oprot.writeFieldEnd();
        }
        if (struct.instance != null) {
          oprot.writeFieldBegin(INSTANCE_FIELD_DESC);
          struct.instance.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class updateInstance_argsTupleSchemeFactory implements SchemeFactory {
      public updateInstance_argsTupleScheme getScheme() {
        return new updateInstance_argsTupleScheme();
      }
    }

    private static class updateInstance_argsTupleScheme extends TupleScheme<updateInstance_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, updateInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetProjection()) {
          optionals.set(0);
        }
        if (struct.isSetDiscoveryProjection()) {
          optionals.set(1);
        }
        if (struct.isSetInstance()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetProjection()) {
          struct.projection.write(oprot);
        }
        if (struct.isSetDiscoveryProjection()) {
          struct.discoveryProjection.write(oprot);
        }
        if (struct.isSetInstance()) {
          struct.instance.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, updateInstance_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.projection = new CuratorProjection();
          struct.projection.read(iprot);
          struct.setProjectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.discoveryProjection = new DiscoveryProjection();
          struct.discoveryProjection.read(iprot);
          struct.setDiscoveryProjectionIsSet(true);
        }
        if (incoming.get(2)) {
          struct.instance = new DiscoveryInstance();
          struct.instance.read(iprot);
          struct.setInstanceIsSet(true);
        }
      }
    }

  }

  public static class updateInstance_result implements org.apache.thrift.TBase<updateInstance_result, updateInstance_result._Fields>, java.io.Serializable, Cloneable, Comparable<updateInstance_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("updateInstance_result");

    private static final org.apache.thrift.protocol.TField EX1_FIELD_DESC = new org.apache.thrift.protocol.TField("ex1", org.apache.thrift.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 updateInstance_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new updateInstance_resultTupleSchemeFactory());
    }

    public CuratorException ex1; // 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 {
      EX1((short)1, "ex1");

      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: // EX1
            return EX1;
          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.EX1, new org.apache.thrift.meta_data.FieldMetaData("ex1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(updateInstance_result.class, metaDataMap);
    }

    public updateInstance_result() {
    }

    public updateInstance_result(
      CuratorException ex1)
    {
      this();
      this.ex1 = ex1;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public updateInstance_result(updateInstance_result other) {
      if (other.isSetEx1()) {
        this.ex1 = new CuratorException(other.ex1);
      }
    }

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

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

    public CuratorException getEx1() {
      return this.ex1;
    }

    public updateInstance_result setEx1(CuratorException ex1) {
      this.ex1 = ex1;
      return this;
    }

    public void unsetEx1() {
      this.ex1 = null;
    }

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

    public void setEx1IsSet(boolean value) {
      if (!value) {
        this.ex1 = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case EX1:
        if (value == null) {
          unsetEx1();
        } else {
          setEx1((CuratorException)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case EX1:
        return getEx1();

      }
      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 EX1:
        return isSetEx1();
      }
      throw new IllegalStateException();
    }

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

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

      boolean this_present_ex1 = true && this.isSetEx1();
      boolean that_present_ex1 = true && that.isSetEx1();
      if (this_present_ex1 || that_present_ex1) {
        if (!(this_present_ex1 && that_present_ex1))
          return false;
        if (!this.ex1.equals(that.ex1))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      return 0;
    }

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

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetEx1()).compareTo(other.isSetEx1());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetEx1()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex1, other.ex1);
        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("updateInstance_result(");
      boolean first = true;

      sb.append("ex1:");
      if (this.ex1 == null) {
        sb.append("null");
      } else {
        sb.append(this.ex1);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // 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 updateInstance_resultStandardSchemeFactory implements SchemeFactory {
      public updateInstance_resultStandardScheme getScheme() {
        return new updateInstance_resultStandardScheme();
      }
    }

    private static class updateInstance_resultStandardScheme extends StandardScheme<updateInstance_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, updateInstance_result 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: // EX1
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ex1 = new CuratorException();
                struct.ex1.read(iprot);
                struct.setEx1IsSet(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, updateInstance_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.ex1 != null) {
          oprot.writeFieldBegin(EX1_FIELD_DESC);
          struct.ex1.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class updateInstance_resultTupleSchemeFactory implements SchemeFactory {
      public updateInstance_resultTupleScheme getScheme() {
        return new updateInstance_resultTupleScheme();
      }
    }

    private static class updateInstance_resultTupleScheme extends TupleScheme<updateInstance_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, updateInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetEx1()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetEx1()) {
          struct.ex1.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, updateInstance_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.ex1 = new CuratorException();
          struct.ex1.read(iprot);
          struct.setEx1IsSet(true);
        }
      }
    }

  }

}
