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

com.pervasivecode.utils.measure.QuantityFormatter Maven / Gradle / Ivy

Go to download

Classes for using and formatting data and data-rate values in the JSR 363 Units of Measurement API.

The newest version!
package com.pervasivecode.utils.measure;

import java.util.Locale;
import javax.measure.Quantity;
import javax.measure.quantity.Length;

/**
 * Instances can format a Quantity of a given type in a representation that makes sense for a given
 * locale.
 * 

* Example: A value of {@link Quantity}<{@link Length}> representing 33.5 centimeters could be * formatted for the {@link Locale#US US} locale as "33.5 cm". It could also be formatted as "0.335 * meters". One reasonable formatted representation for the same value in the {@link Locale#FRANCE * FRANCE} locale would be "33,5 centimètres". * * @param The kind of Quantity that this object can format. Example: {@link Length} */ public interface QuantityFormatter> { /** * Format the specified quantity, according to the rules and locale inherent to this instance of * QuantityFormatter. * * @param quantity The quantity that should be formatted. * * @return The formatted representation of the quantity. */ public String format(Quantity quantity); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy