Esempio n. 1
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);
   }
 }
Esempio n. 2
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;
  }