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

open_rtb.Segment Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */

package open_rtb;

/** 3.3.14 Segment Object
The data and segment objects together allow data about the user to be passed to bidders in the bid request. Segment objects convey specific units of information from the provider identified in the parent data object.
The segment object itself and all of its parameters are optional, so default values are not provided; if an optional parameter is not specified, it should be considered unknown. */
public interface Segment
  extends java.util.function.Supplier,
          java.lang.Comparable>,
          java.io.Serializable {

  /** True if all fields are set to default values. */
  default boolean isDefault() {
    return
      isDefaultId() &&
      isDefaultName() &&
      isDefaultValue();
  }

  /** Returns underlying object. */
  T get();

  /** Creates a new builder based on this object. */
  Builder newBuilder();

  /** ID of a data provider’s segment applicable to the user. */
  java.lang.String getId();

  boolean isDefaultId();

  /** Name of a data provider’s segment applicable to the user. */
  java.lang.String getName();

  boolean isDefaultName();

  /** String representing the value of the segment. The method for transmitting this data should be negotiated offline with the data provider. For example for gender, “male”, or “female”, for age, “30-40”). */
  java.lang.String getValue();

  boolean isDefaultValue();

  public interface Builder {

    Segment build();

    Builder setId(java.lang.String value);

    Builder clearId();

    Builder setName(java.lang.String value);

    Builder clearName();

    Builder setValue(java.lang.String value);

    Builder clearValue();
  }


  static class Comparator implements java.util.Comparator>, java.io.Serializable {

    @Override public int compare(open_rtb.Segment a, open_rtb.Segment b) {
      int _cmp;
      if (0 != (_cmp = compareId(a, b))) return _cmp;
      if (0 != (_cmp = compareName(a, b))) return _cmp;
      if (0 != (_cmp = compareValue(a, b))) return _cmp;
      return 0;
    }

    static private int compareId (open_rtb.Segment a, open_rtb.Segment b) {
      final java.lang.String fa = a.getId();
      final java.lang.String fb = b.getId();
      return fa.compareTo(fb);
    }

    static private int compareName (open_rtb.Segment a, open_rtb.Segment b) {
      final java.lang.String fa = a.getName();
      final java.lang.String fb = b.getName();
      return fa.compareTo(fb);
    }

    static private int compareValue (open_rtb.Segment a, open_rtb.Segment b) {
      final java.lang.String fa = a.getValue();
      final java.lang.String fb = b.getValue();
      return fa.compareTo(fb);
    }

    static private final Comparator INSTANCE = new Comparator();

    static public final long serialVersionUID = 3;
  }

  /** Returns comparator instance for Segment objects. */
  static java.util.Comparator> getComparator() {
    return Comparator.INSTANCE;
  }

  @Override default int compareTo(open_rtb.Segment other) {
    return getComparator().compare(this, other);
  }

  static class NativeImpl implements open_rtb.Segment {

    transient private java.lang.String json;
    private java.lang.String __id;
    transient private java.lang.Boolean is_default$id;
    private java.lang.String __name;
    transient private java.lang.Boolean is_default$name;
    private java.lang.String __value;
    transient private java.lang.Boolean is_default$value;

    private NativeImpl() {
      __id = "";
      is_default$id = java.lang.Boolean.TRUE;
      __name = "";
      is_default$name = java.lang.Boolean.TRUE;
      __value = "";
      is_default$value = java.lang.Boolean.TRUE;
      json = "{}";
    }

    private NativeImpl(NativeImpl other) {
      setId(other.getId());
      setName(other.getName());
      setValue(other.getValue());
      json = other.json;
    }

    @Override public NativeImpl get() {
      return this;
    }

    @Override public Builder newBuilder() {
      return newNativeImplBuilder(this);
    }

    private java.lang.String buildJson() {
      java.lang.StringBuilder sb = new StringBuilder();
      if (!isDefaultId()) {
        sb.append((0 == sb.length()) ? "{\"id\": " : ", \"id\": ")
          .append("\"" + __id.replace("\"","\\\"") + '\"');
      }
      if (!isDefaultName()) {
        sb.append((0 == sb.length()) ? "{\"name\": " : ", \"name\": ")
          .append("\"" + __name.replace("\"","\\\"") + '\"');
      }
      if (!isDefaultValue()) {
        sb.append((0 == sb.length()) ? "{\"value\": " : ", \"value\": ")
          .append("\"" + __value.replace("\"","\\\"") + '\"');
      }
      return (0 == sb.length()) ? "{}" : sb.append('}').toString();
    }

    @Override public String toString() {
      if (null == json) {
        json = buildJson();
      }
      return json;
    }

    @Override public int hashCode() {
      return toString().hashCode();
    }

    @Override public boolean equals(Object other) {
      if (other == this) return true;
      if (other == null || !(other instanceof NativeImpl)) return false;
      return toString().equals(other.toString());
    }

    @Override public java.lang.String getId() {
      return __id;
    }

    @Override public boolean isDefaultId() {
      if (null == is_default$id) {
        is_default$id = getId().length() == 0;
      }
      return is_default$id;
    }

    private void setId(java.lang.String value) {
      this.__id = value;
      this.is_default$id = null;
      this.json = null;
    }

    @Override public java.lang.String getName() {
      return __name;
    }

    @Override public boolean isDefaultName() {
      if (null == is_default$name) {
        is_default$name = getName().length() == 0;
      }
      return is_default$name;
    }

    private void setName(java.lang.String value) {
      this.__name = value;
      this.is_default$name = null;
      this.json = null;
    }

    @Override public java.lang.String getValue() {
      return __value;
    }

    @Override public boolean isDefaultValue() {
      if (null == is_default$value) {
        is_default$value = getValue().length() == 0;
      }
      return is_default$value;
    }

    private void setValue(java.lang.String value) {
      this.__value = value;
      this.is_default$value = null;
      this.json = null;
    }

    static class NativeImplBuilder implements Builder {

      private NativeImpl wrapped = new NativeImpl();

      @Override public open_rtb.Segment build() {
        return new NativeImpl(wrapped);
      }

      @Override public Builder setId(java.lang.String value) {
        if (value.length() == 0) {
          return clearId();
        }
        wrapped.setId(value);
        return this;
      }

      @Override public Builder clearId() {
        wrapped.__id = _DEFAULT.get().__id;
        wrapped.is_default$id = true;
        return this;
      }

      @Override public Builder setName(java.lang.String value) {
        if (value.length() == 0) {
          return clearName();
        }
        wrapped.setName(value);
        return this;
      }

      @Override public Builder clearName() {
        wrapped.__name = _DEFAULT.get().__name;
        wrapped.is_default$name = true;
        return this;
      }

      @Override public Builder setValue(java.lang.String value) {
        if (value.length() == 0) {
          return clearValue();
        }
        wrapped.setValue(value);
        return this;
      }

      @Override public Builder clearValue() {
        wrapped.__value = _DEFAULT.get().__value;
        wrapped.is_default$value = true;
        return this;
      }
    }

    static private java.lang.ThreadLocal _DEFAULT = new java.lang.ThreadLocal() {
      @Override protected NativeImpl initialValue() {
        NativeImpl instance = new NativeImpl();
        assert instance.isDefault();
        return instance;
      }
    };

    static public final long serialVersionUID = 3;
  }

  /** Returns a POJO builder instance with default values. */
  static Builder newNativeImplBuilder() { return new NativeImpl.NativeImplBuilder(); }

  /** Returns a POJO builder instance based on existing prototype Segment. */
  static Builder newNativeImplBuilder(open_rtb.Segment other) {
    return newNativeImplBuilder()
      .setId(other.getId())
      .setName(other.getName())
      .setValue(other.getValue());
  }

  /** Returns a POJO based on an instance of Segment. */
  static NativeImpl nativeImpl(open_rtb.Segment instance) {
    if (instance instanceof NativeImpl) {
      return (NativeImpl) instance;
    } else {
      return (NativeImpl) newNativeImplBuilder(instance).build();
    }
  }

  static class Avro implements open_rtb.Segment {

    private byte[] binaryEncoding;
    transient private open_rtb.SegmentAvro wrapped;
    transient private java.lang.Boolean is_default$id;
    transient private java.lang.String _id;
    transient private java.lang.Boolean is_default$name;
    transient private java.lang.String _name;
    transient private java.lang.Boolean is_default$value;
    transient private java.lang.String _value;

    private Avro(open_rtb.SegmentAvro wrapped, byte[] binaryEncoding) {
      this.wrapped = wrapped;
      this.binaryEncoding = binaryEncoding;
    }

    /** Constructs a new Avro instance based on a message's binary encoding. Only use this if you know what you're doing. */
    public Avro(byte[] binaryEncoding) { this(null, binaryEncoding); }

    @Override public open_rtb.SegmentAvro get() {
      if (wrapped == null) {
        try {
          wrapped = decode(binaryEncoding);
        } catch (java.io.IOException e) {
          throw new java.io.UncheckedIOException(e);
        }
      }
      return wrapped;
    }

    @Override public Builder newBuilder() {
      return newAvroBuilder(get());
    }

    /** Returns an Avro binary encoding of this record. */
    public byte[] toByteArray() {
      return (byte[]) encoded().binaryEncoding.clone();
    }

    /** Returns the Avro binary encoding of this record wrapped in a read-only buffer. */
    public java.nio.ByteBuffer toByteBuffer() {
      return java.nio.ByteBuffer.wrap(encoded().binaryEncoding).asReadOnlyBuffer();
    }

    @Override public java.lang.String getId() {
      if (_id == null) {
        _id = java.util.Optional.of(get().id).map(java.lang.Object::toString).orElse("");
      }
      return _id;
    }

    @Override public boolean isDefaultId() {
      if (is_default$id == null) {
        is_default$id = getId().length() == 0;
      }
      return is_default$id;
    }

    @Override public java.lang.String getName() {
      if (_name == null) {
        _name = java.util.Optional.of(get().name).map(java.lang.Object::toString).orElse("");
      }
      return _name;
    }

    @Override public boolean isDefaultName() {
      if (is_default$name == null) {
        is_default$name = getName().length() == 0;
      }
      return is_default$name;
    }

    @Override public java.lang.String getValue() {
      if (_value == null) {
        _value = java.util.Optional.of(get().value).map(java.lang.Object::toString).orElse("");
      }
      return _value;
    }

    @Override public boolean isDefaultValue() {
      if (is_default$value == null) {
        is_default$value = getValue().length() == 0;
      }
      return is_default$value;
    }

    @Override public boolean equals(Object other) {
      if (other == this) return true;
      if (other == null && !(other instanceof Avro)) return false;
      return get().equals(((Avro) other).get());
    }

    @Override public int hashCode() { return get().hashCode(); }

    @Override public String toString() { return get().toString(); }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      if (binaryEncoding == null) { encode(); }
      out.defaultWriteObject();
    }

    public Avro encoded() {
      if (binaryEncoding != null) {
        try {
          encode();
        } catch (java.io.IOException e) {
          throw new java.io.UncheckedIOException(e);
        }
      }
      return this;
    }

    private void encode() throws java.io.IOException {
      java.io.ByteArrayOutputStream stream = _ENCODER_STREAM.get();
      org.apache.avro.io.BinaryEncoder encoder = _ENCODER.get();
      stream.reset();
      wrapped.encode(encoder);
      encoder.flush();
      binaryEncoding = stream.toByteArray();
    }

    static private open_rtb.SegmentAvro decode(byte[] binaryEncoding) throws java.io.IOException {
      open_rtb.SegmentAvro instance = new open_rtb.SegmentAvro();
      org.apache.avro.io.BinaryDecoder decoder = org.apache.avro.io.DecoderFactory.get().binaryDecoder(binaryEncoding, _DECODER.get());
      return instance.decode(decoder);
    }

    /** Decodes a Avro record. */
    static public open_rtb.Segment from(byte[] binaryEncoding) throws java.io.IOException {
      return new Avro(decode(binaryEncoding), binaryEncoding);
    }

    static private java.lang.ThreadLocal _DECODER = new java.lang.ThreadLocal() {
      @Override protected org.apache.avro.io.BinaryDecoder initialValue() { return org.apache.avro.io.DecoderFactory.get().binaryDecoder(new byte[0], null); }
    };

    static private java.lang.ThreadLocal _ENCODER_STREAM = new java.lang.ThreadLocal() {
      @Override protected java.io.ByteArrayOutputStream initialValue() { return new java.io.ByteArrayOutputStream(); }
    };

    static private java.lang.ThreadLocal _ENCODER = new java.lang.ThreadLocal() {
      @Override protected org.apache.avro.io.BinaryEncoder initialValue() { return org.apache.avro.io.EncoderFactory.get().binaryEncoder(_ENCODER_STREAM.get(), null); }
    };

    static private java.lang.ThreadLocal _DEFAULT = new java.lang.ThreadLocal() {
      @Override protected Avro initialValue() { return new Avro(open_rtb.SegmentAvro.newBuilder().build(), null); }
    };

    static public final long serialVersionUID = 3;
  }

  static class AvroBuilder implements Builder {

    final private open_rtb.SegmentAvro.Builder builder;

    /** Only use this if you know what you are doing. */
    public AvroBuilder(open_rtb.SegmentAvro.Builder builder) { this.builder = builder; }

    @Override public open_rtb.Segment build() {
      return new Avro(builder.build(), null);
    }

    @Override public Builder setId(java.lang.String value) {
      builder.setId(new org.apache.avro.util.Utf8(value));
      return this;
    }

    @Override public Builder clearId() {
      builder.clearId();
      return this;
    }

    @Override public Builder setName(java.lang.String value) {
      builder.setName(new org.apache.avro.util.Utf8(value));
      return this;
    }

    @Override public Builder clearName() {
      builder.clearName();
      return this;
    }

    @Override public Builder setValue(java.lang.String value) {
      builder.setValue(new org.apache.avro.util.Utf8(value));
      return this;
    }

    @Override public Builder clearValue() {
      builder.clearValue();
      return this;
    }
  }

  /** Returns new Avro builder instance with default values. */
  static Builder newAvroBuilder() {
    return new AvroBuilder(open_rtb.SegmentAvro.newBuilder());
  }

  /** Returns new Avro builder instance based on existing prototype. */
  static Builder newAvroBuilder(open_rtb.SegmentAvro other) {
    return new AvroBuilder(open_rtb.SegmentAvro.newBuilder(other));
  }

  /** Returns new Avro builder instance based on existing prototype builder. */
  static Builder newAvroBuilder(open_rtb.SegmentAvro.Builder other) {
    return new AvroBuilder(open_rtb.SegmentAvro.newBuilder(other));
  }

  /** Returns new Avro builder instance based on existing prototype Segment. */
  static Builder newAvroBuilder(open_rtb.Segment other) {
    return newAvroBuilder()
      .setId(other.getId())
      .setName(other.getName())
      .setValue(other.getValue());
  }

  /** Returns a wrapped Avro record based on an instance of Segment. */
  static Avro avro(open_rtb.Segment instance) {
    if (instance instanceof Avro) {
      return (Avro) instance;
    } else {
      return (Avro) newAvroBuilder(instance).build();
    }
  }

  /** Wraps an existing Avro record. */
  static Avro avro(open_rtb.SegmentAvro wrapped) {
    assert wrapped != null;
    return new Avro(wrapped.freeze(), null);
  }

  /** Returns Avro record class. */
  static java.lang.Class getAvroClass() {
    return open_rtb.SegmentAvro.class;
  }

  /** Returns Avro record schema. */
  static org.apache.avro.Schema getAvroSchema() {
    return open_rtb.SegmentAvro.SCHEMA$;
  }

  static class Protobuf implements open_rtb.Segment {

    private byte[] binaryEncoding;
    transient private open_rtb.OpenRtbProtobuf.Segment wrapped;
    transient private java.lang.Boolean is_default$id;
    transient private java.lang.Boolean is_default$name;
    transient private java.lang.Boolean is_default$value;

    private Protobuf(open_rtb.OpenRtbProtobuf.Segment wrapped, byte[] binaryEncoding) {
      this.wrapped = wrapped;
      this.binaryEncoding = binaryEncoding;
    }

    /** Constructs a new Protobuf instance based on a message's binary encoding. Only use this if you know what you're doing. */
    public Protobuf(byte[] binaryEncoding) { this(null, binaryEncoding); }

    @Override public open_rtb.OpenRtbProtobuf.Segment get() {
      if (wrapped == null) {
        try {
          wrapped = open_rtb.OpenRtbProtobuf.Segment.parseFrom(binaryEncoding);
        } catch (java.io.IOException e) {
          throw new java.io.UncheckedIOException(e);
        }
      }
      return wrapped;
    }

    @Override public Builder newBuilder() {
      return newProtobufBuilder(get());
    }

    @Override public java.lang.String getId() {
      return get().getId();
    }

    @Override public boolean isDefaultId() {
      if (is_default$id == null) {
        is_default$id = getId().length() == 0;
      }
      return is_default$id;
    }

    @Override public java.lang.String getName() {
      return get().getName();
    }

    @Override public boolean isDefaultName() {
      if (is_default$name == null) {
        is_default$name = getName().length() == 0;
      }
      return is_default$name;
    }

    @Override public java.lang.String getValue() {
      return get().getValue();
    }

    @Override public boolean isDefaultValue() {
      if (is_default$value == null) {
        is_default$value = getValue().length() == 0;
      }
      return is_default$value;
    }

    @Override public boolean equals(Object other) {
      if (other == this) return true;
      if (other == null && !(other instanceof Protobuf)) return false;
      return get().equals(((Protobuf) other).get());
    }

    @Override public int hashCode() { return get().hashCode(); }

    @Override public String toString() { return get().toString(); }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      if (binaryEncoding == null) {
        binaryEncoding = wrapped.toByteArray();
      }
      out.defaultWriteObject();
    }

    /** Decodes a Protobuf message. */
    static public open_rtb.Segment from(byte[] binaryEncoding) throws java.io.IOException {
      return new Protobuf(open_rtb.OpenRtbProtobuf.Segment.parseFrom(binaryEncoding), binaryEncoding);
    }

    static private java.lang.ThreadLocal _DEFAULT = new java.lang.ThreadLocal() {
      @Override protected Protobuf initialValue() { return new Protobuf(open_rtb.OpenRtbProtobuf.Segment.getDefaultInstance() , null); }
    };

    static public final long serialVersionUID = 3;
  }

  static class ProtobufBuilder implements Builder {

    final private open_rtb.OpenRtbProtobuf.Segment.Builder builder;

    /** Only use this if you know what you are doing. */
    public ProtobufBuilder(open_rtb.OpenRtbProtobuf.Segment.Builder builder) { this.builder = builder; }

    @Override public open_rtb.Segment build() {
      return new Protobuf(builder.build(), null);
    }

    @Override public Builder setId(java.lang.String value) {
      if (!(value.length() == 0)) {
        builder.setId(value);
      }
      return this;
    }

    @Override public Builder clearId() {
      builder.clearId();
      return this;
    }

    @Override public Builder setName(java.lang.String value) {
      if (!(value.length() == 0)) {
        builder.setName(value);
      }
      return this;
    }

    @Override public Builder clearName() {
      builder.clearName();
      return this;
    }

    @Override public Builder setValue(java.lang.String value) {
      if (!(value.length() == 0)) {
        builder.setValue(value);
      }
      return this;
    }

    @Override public Builder clearValue() {
      builder.clearValue();
      return this;
    }
  }

  /** Returns new Protobuf builder instance with default values. */
  static Builder newProtobufBuilder() {
    return new ProtobufBuilder(open_rtb.OpenRtbProtobuf.Segment.newBuilder());
  }

  /** Returns new Protobuf builder instance based on existing prototype. */
  static Builder newProtobufBuilder(open_rtb.OpenRtbProtobuf.Segment other) {
    return new ProtobufBuilder(open_rtb.OpenRtbProtobuf.Segment.newBuilder(other));
  }

  /** Returns new Protobuf builder instance based on existing prototype Segment. */
  static Builder newProtobufBuilder(open_rtb.Segment other) {
    return newProtobufBuilder()
      .setId(other.getId())
      .setName(other.getName())
      .setValue(other.getValue());
  }

  /** Returns a wrapped Protobuf message based on an instance of Segment. */
  static Protobuf protobuf(open_rtb.Segment instance) {
    if (instance instanceof Protobuf) {
      return (Protobuf) instance;
    }
    return (Protobuf) newProtobufBuilder(instance).build();
  }

  /** Wraps an existing Protobuf message. */
  static Protobuf protobuf(open_rtb.OpenRtbProtobuf.Segment wrapped) {
    assert wrapped != null;
    return new Protobuf(wrapped, null);
  }

  /** Returns Protobuf class for this struct. */
  static java.lang.Class getProtobufClass() {
    return open_rtb.OpenRtbProtobuf.Segment.class;
  }

  /** Returns Protobuf protocol class for this struct. */
  static java.lang.Class getProtobufProtocolClass() {
    return com.adgear.anoa.test.ad_exchange.AdExchangeProtobuf.class;
  }

  /** Returns Protobuf descriptor for this struct. */
  static com.google.protobuf.Descriptors.Descriptor getProtobufDescriptor() {
    return open_rtb.OpenRtbProtobuf.Segment.getDescriptor();
  }

  /** Returns Protobuf protocol descriptor for this struct. */
  static com.google.protobuf.Descriptors.FileDescriptor getProtobufProtocolDescriptor() {
    return com.adgear.anoa.test.ad_exchange.AdExchangeProtobuf.getDescriptor();
  }

  static class Thrift implements open_rtb.Segment {

    private open_rtb.SegmentThrift wrapped;
    transient private java.lang.Boolean is_default$id;
    transient private java.lang.String _id;
    transient private java.lang.Boolean is_default$name;
    transient private java.lang.String _name;
    transient private java.lang.Boolean is_default$value;
    transient private java.lang.String _value;

    /** Wraps an existing instance. Only use this if you know what you are doing. */
    public Thrift(open_rtb.SegmentThrift wrapped) { this.wrapped = wrapped; }

    /** Create a new wrapper. */
    public Thrift() { this(new open_rtb.SegmentThrift()); }

    @Override public open_rtb.SegmentThrift get() { return wrapped; }

    @Override public Builder newBuilder() {
      return newThriftBuilder(get());
    }

    @Override public java.lang.String getId() {
      if (_id == null) {
        _id = java.util.Optional.ofNullable(wrapped.getId()).orElse("");
      }
      return _id;
    }

    @Override public boolean isDefaultId() {
      if (is_default$id == null) {
        is_default$id = getId().length() == 0;
      }
      return is_default$id;
    }

    @Override public java.lang.String getName() {
      if (_name == null) {
        _name = java.util.Optional.ofNullable(wrapped.getName()).orElse("");
      }
      return _name;
    }

    @Override public boolean isDefaultName() {
      if (is_default$name == null) {
        is_default$name = getName().length() == 0;
      }
      return is_default$name;
    }

    @Override public java.lang.String getValue() {
      if (_value == null) {
        _value = java.util.Optional.ofNullable(wrapped.getValue()).orElse("");
      }
      return _value;
    }

    @Override public boolean isDefaultValue() {
      if (is_default$value == null) {
        is_default$value = getValue().length() == 0;
      }
      return is_default$value;
    }

    @Override public boolean equals(Object other) {
      if (other == this) return true;
      if (other == null || !(other instanceof Thrift)) return false;
      return wrapped.equals(((Thrift) other).wrapped);
    }

    @Override public int hashCode() { return wrapped.hashCode(); }

    @Override public String toString() { return wrapped.toString(); }

    static private java.lang.ThreadLocal _DEFAULT = new java.lang.ThreadLocal() {
      @Override protected Thrift initialValue() { return new Thrift(); }
    };

    static public final long serialVersionUID = 3;
  }

  static class ThriftBuilder implements Builder {

    final private open_rtb.SegmentThrift builder;

    /** Only use this if you know what you are doing. */
    public ThriftBuilder(open_rtb.SegmentThrift builder) { this.builder = builder; }

    @Override public open_rtb.Segment build() {
      return new Thrift((open_rtb.SegmentThrift) builder.deepCopy());
    }

    @Override public Builder setId(java.lang.String value) {
      if (!(value.length() == 0)) {
        builder.setId(value);
      }
      return this;
    }

    @Override public Builder clearId() {
      builder.unsetId();
      return this;
    }

    @Override public Builder setName(java.lang.String value) {
      if (!(value.length() == 0)) {
        builder.setName(value);
      }
      return this;
    }

    @Override public Builder clearName() {
      builder.unsetName();
      return this;
    }

    @Override public Builder setValue(java.lang.String value) {
      if (!(value.length() == 0)) {
        builder.setValue(value);
      }
      return this;
    }

    @Override public Builder clearValue() {
      builder.unsetValue();
      return this;
    }
  }

  /** Returns new Thrift builder instance with default values. */
  static Builder newThriftBuilder() {
    return new ThriftBuilder(new open_rtb.SegmentThrift());
  }

  /** Returns new Thrift builder instance based on existing prototype. */
  static Builder newThriftBuilder(open_rtb.SegmentThrift other) {
    return new ThriftBuilder((open_rtb.SegmentThrift) other.deepCopy());
  }

  /** Returns new Thrift builder instance based on existing prototype Segment. */
  static Builder newThriftBuilder(open_rtb.Segment other) {
    return newThriftBuilder()
      .setId(other.getId())
      .setName(other.getName())
      .setValue(other.getValue());
  }

  /** Returns a wrapped Thrift struct based on an instance of Segment. */
  static Thrift thrift(open_rtb.Segment instance) {
    if (instance instanceof Thrift) {
      return (Thrift) instance;
    }
    return (Thrift) newThriftBuilder(instance).build();
  }

  /** Creates a new wrapped Thrift struct copied from an existing instance. */
  @SuppressWarnings("all")
  static Thrift thrift(open_rtb.SegmentThrift instance) {
    return new Thrift((open_rtb.SegmentThrift) instance.deepCopy());
  }

  /** Returns Thrift class for this struct. */
  static java.lang.Class getThriftClass() {
    return open_rtb.SegmentThrift.class;
  }

  /** Returns Thrift metadata map for this struct. */
  static java.util.Map getThriftMetadataMap() {
    return open_rtb.SegmentThrift.metaDataMap;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy