001/**
002 * Unit-API - Units of Measurement API for Java
003 * Copyright (c) 2014 Jean-Marie Dautelle, Werner Keil, V2COM
004 * All rights reserved.
005 *
006 * See LICENSE.txt for details.
007 */
008package javax.measure.spi;
009
010import javax.measure.Quantity;
011import javax.measure.Unit;
012
013/**
014 * Represents a factory that accepts {@linkplain Number} and {@link Unit} arguments to create a {@link Quantity} result.
015 *
016 * <p>This is a <a href="http://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html#package.description">functional interface</a>
017 * whose functional method is {@link #create(T, U)}.
018 *
019 * @param <Q> the type of the {@link Quantity} result
020 *
021 * @author <a href="mailto:[email protected]">Werner Keil</a>
022 * @author <a href="mailto:[email protected]">Otavio Santana</a>
023 * @version 0.5, $Date: 2014-09-18 $
024 */
025public interface QuantityFactory <Q extends Quantity<Q>> {
026
027    /**
028     * Returns the quantity for the specified number stated in the specified unit.
029     *
030     * @param number the numeric value stated in the specified unit
031     * @param unit the unit
032     * @return the corresponding quantity
033     */
034    <N extends Number, U extends Unit<Q>> Quantity<Q> create(N number, U unit);
035}