示例#1
0
  public boolean equals(Endpoint that) {
    if (that == null) return false;

    boolean this_present_ipv4 = true;
    boolean that_present_ipv4 = true;
    if (this_present_ipv4 || that_present_ipv4) {
      if (!(this_present_ipv4 && that_present_ipv4)) return false;
      if (this.ipv4 != that.ipv4) return false;
    }

    boolean this_present_port = true;
    boolean that_present_port = true;
    if (this_present_port || that_present_port) {
      if (!(this_present_port && that_present_port)) return false;
      if (this.port != that.port) return false;
    }

    boolean this_present_service_name = true && this.isSetService_name();
    boolean that_present_service_name = true && that.isSetService_name();
    if (this_present_service_name || that_present_service_name) {
      if (!(this_present_service_name && that_present_service_name)) return false;
      if (!this.service_name.equals(that.service_name)) return false;
    }

    return true;
  }
示例#2
0
 /** Performs a deep copy on <i>other</i>. */
 public Endpoint(Endpoint other) {
   __isset_bitfield = other.__isset_bitfield;
   this.ipv4 = other.ipv4;
   this.port = other.port;
   if (other.isSetService_name()) {
     this.service_name = other.service_name;
   }
 }
示例#3
0
  @Override
  public int compareTo(Endpoint other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetIpv4()).compareTo(other.isSetIpv4());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIpv4()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ipv4, other.ipv4);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPort()).compareTo(other.isSetPort());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPort()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, other.port);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetService_name()).compareTo(other.isSetService_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetService_name()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.service_name, other.service_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
示例#4
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, Endpoint struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetIpv4()) {
     optionals.set(0);
   }
   if (struct.isSetPort()) {
     optionals.set(1);
   }
   if (struct.isSetService_name()) {
     optionals.set(2);
   }
   oprot.writeBitSet(optionals, 3);
   if (struct.isSetIpv4()) {
     oprot.writeI32(struct.ipv4);
   }
   if (struct.isSetPort()) {
     oprot.writeI16(struct.port);
   }
   if (struct.isSetService_name()) {
     oprot.writeString(struct.service_name);
   }
 }
示例#5
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, Endpoint struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(IPV4_FIELD_DESC);
      oprot.writeI32(struct.ipv4);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(PORT_FIELD_DESC);
      oprot.writeI16(struct.port);
      oprot.writeFieldEnd();
      if (struct.service_name != null) {
        oprot.writeFieldBegin(SERVICE_NAME_FIELD_DESC);
        oprot.writeString(struct.service_name);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
示例#6
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, Endpoint 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: // IPV4
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.ipv4 = iprot.readI32();
              struct.setIpv4IsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // PORT
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.port = iprot.readI16();
              struct.setPortIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // SERVICE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.service_name = iprot.readString();
              struct.setService_nameIsSet(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();
    }
示例#7
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, Endpoint struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(3);
   if (incoming.get(0)) {
     struct.ipv4 = iprot.readI32();
     struct.setIpv4IsSet(true);
   }
   if (incoming.get(1)) {
     struct.port = iprot.readI16();
     struct.setPortIsSet(true);
   }
   if (incoming.get(2)) {
     struct.service_name = iprot.readString();
     struct.setService_nameIsSet(true);
   }
 }