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

com.instaclustr.measure.Measure Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy