@Test public void asString() { final MetricValue empty = MetricValue.EMPTY; final MetricValue boolval = MetricValue.fromBoolean(true); final MetricValue intval = MetricValue.fromIntValue(1L); final MetricValue fltval = MetricValue.fromDblValue(1D); final MetricValue strval = MetricValue.fromStrValue("1"); final MetricValue histval = MetricValue.fromHistValue(hist42); assertEquals(Optional.empty(), empty.asString()); assertEquals(Optional.of("true"), boolval.asString()); assertEquals(Optional.of("1"), intval.asString()); assertEquals(Optional.of(Double.toString(1)), fltval.asString()); assertEquals(Optional.of("1"), strval.asString()); assertEquals(Optional.empty(), histval.asString()); }
public abstract Optional<String> asString();
MetricValue implements Comparable<MetricValue>, Serializable { public abstract Optional<String> asString(); }
MetricValue implements Comparable<MetricValue>, Serializable { public abstract Optional<String> asString(); private  MetricValue(); }
MetricValue implements Comparable<MetricValue>, Serializable { public abstract Optional<String> asString(); private  MetricValue(); static MetricValue fromBoolean(boolean b); static MetricValue fromIntValue(long int_value); static MetricValue fromDblValue(double flt_value); static MetricValue fromStrValue(String str_value); static MetricValue fromHistValue(Histogram hist_value); static MetricValue fromNumberValue(Number number); @Override abstract int compareTo(MetricValue o); abstract Optional<Number> value(); abstract Optional<Boolean> asBool(); abstract Optional<String> asString(); Optional<String> stringValue(); Optional<Histogram> histogram(); Boolean getBoolValue(); Long getIntValue(); Double getFltValue(); String getStrValue(); Histogram getHistValue(); abstract String configString(); @Override String toString(); @Override abstract boolean equals(Object o); @Override abstract int hashCode(); boolean isPresent(); boolean isInfinite(); boolean isNaN(); boolean isInfiniteOrNaN(); }
MetricValue implements Comparable<MetricValue>, Serializable { public abstract Optional<String> asString(); private  MetricValue(); static MetricValue fromBoolean(boolean b); static MetricValue fromIntValue(long int_value); static MetricValue fromDblValue(double flt_value); static MetricValue fromStrValue(String str_value); static MetricValue fromHistValue(Histogram hist_value); static MetricValue fromNumberValue(Number number); @Override abstract int compareTo(MetricValue o); abstract Optional<Number> value(); abstract Optional<Boolean> asBool(); abstract Optional<String> asString(); Optional<String> stringValue(); Optional<Histogram> histogram(); Boolean getBoolValue(); Long getIntValue(); Double getFltValue(); String getStrValue(); Histogram getHistValue(); abstract String configString(); @Override String toString(); @Override abstract boolean equals(Object o); @Override abstract int hashCode(); boolean isPresent(); boolean isInfinite(); boolean isNaN(); boolean isInfiniteOrNaN(); static final MetricValue TRUE; static final MetricValue FALSE; static final Optional<MetricValue> OPTIONAL_TRUE; static final Optional<MetricValue> OPTIONAL_FALSE; static MetricValue EMPTY; }