com.instaclustr.measure.Measure Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons Show documentation
Show all versions of commons Show documentation
Common classes and utilities integrated with various projects
package com.instaclustr.measure;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/***
* A value and its associated unit. e.g. 1 metre, 10 hours, 20
* @param the value type
* @param the unit type
*/
public abstract class Measure> {
public final V value;
public final U unit;
@JsonCreator
public Measure(@JsonProperty("value") final V value, @JsonProperty("unit") final U unit) {
this.value = value;
this.unit = unit;
}
@Override
public String toString() {
return String.format("%s %s", value, unit);
}
}