public <T extends Collector> T setChild(Child child, String... labelValues) {
    if (labelValues.length != labelNames.size()) {
      throw new IllegalArgumentException("Incorrect number of labels.");
    }
    children.put(Arrays.asList(labelValues), child);
    return (T)this;
  }
public < T extends Collector > T setChild ( Child child , String ... labelValues ) { if ( labelValues . length != labelNames . size ( ) ) { throw new IllegalArgumentException ( "Incorrect number of labels." ) ; } children . put ( Arrays . asList ( labelValues ) , child ) ; return ( T ) this ; }
Replace the Child with the given labels.
<p>
This is intended for advanced uses, in particular proxying metrics
from another monitoring system. This allows for callbacks for returning
values for {@link Counter} and {@link Gauge} without having to implement
a full {@link Collector}.
<p>
An example with {@link Gauge}:
<pre>
{@code
Gauge.build().name("current_time").help("Current unixtime.").create()
.setChild(new Gauge.Child() {
public double get() {
return System.currentTimeMillis() / MILLISECONDS_PER_SECOND;
}
}).register();
}
</pre>
<p>
Any references any previous Child with these labelValues are invalidated.
A metric should be either all callbacks, or none.