class Builder {

        private Double value = null;
        private Labels labels = Labels.EMPTY;
        private String traceId = null;
        private String spanId = null;
        private long timestampMillis = 0L;

        private Builder() {
        }

        public Builder value(double value) {
            this.value = value;
            return this;
        }

        public Builder traceId(String traceId) {
            this.traceId = traceId;
            return this;
        }

        public Builder spanId(String spanId) {
            this.spanId = spanId;
            return this;
        }

        public Builder labels(Labels labels) {
            if (labels == null) {
                throw new NullPointerException();
            }
            this.labels = labels;
            return this;
        }

        public Builder timestampMillis(long timestampMillis) {
            this.timestampMillis = timestampMillis;
            return this;
        }

        /**
         * @throws IllegalStateException if {@link #value(double)} wasn't called.
         */
        public Exemplar build() {<FILL_FUNCTION_BODY>}
    }

            if (value == null) {
                throw new IllegalStateException("cannot build an Exemplar without a value");
            }
            Labels allLabels;
            if (traceId != null && spanId != null) {
                allLabels = Labels.of(TRACE_ID, traceId, SPAN_ID, spanId);
            } else if (traceId != null) {
                allLabels = Labels.of(TRACE_ID, traceId);
            } else if (spanId != null) {
                allLabels = Labels.of(SPAN_ID, spanId);
            } else {
                allLabels = Labels.EMPTY;
            }
            if (!labels.isEmpty()) {
                allLabels = allLabels.merge(labels);
            }
            return new Exemplar(value, allLabels, timestampMillis);
        
<no_super_class>