QuantityType extends Number implements PrimitiveType, State, Command, Comparable<QuantityType<T>> { public QuantityType<?> multiply(BigDecimal value) { return new QuantityType<>(this.quantity.multiply(value)); } @SuppressWarnings("unchecked")  QuantityType(); @SuppressWarnings("unchecked")  QuantityType(String value);  QuantityType(Number value, Unit<T> unit); private  QuantityType(Quantity<T> quantity); static QuantityType<T> valueOf(double value, Unit<T> unit); @Override String toString(); static QuantityType<? extends Quantity<?>> valueOf(String value); @SuppressWarnings("unchecked") @Override boolean equals(@Nullable Object obj); @Override int compareTo(QuantityType<T> o); Unit<T> getUnit(); Dimension getDimension(); @SuppressWarnings("unchecked") @Nullable QuantityType<T> toUnit(Unit<?> targetUnit); @SuppressWarnings("unchecked") @Nullable QuantityType<T> toUnit(String targetUnit); BigDecimal toBigDecimal(); @Override int hashCode(); @Override String format(String pattern); @Override int intValue(); @Override long longValue(); @Override float floatValue(); @Override double doubleValue(); @Override String toFullString(); @Override U as(@Nullable Class<U> target); QuantityType<T> add(QuantityType<T> state); QuantityType<T> negate(); QuantityType<T> subtract(QuantityType<T> state); QuantityType<?> multiply(BigDecimal value); QuantityType<?> multiply(QuantityType<?> state); QuantityType<?> divide(BigDecimal value); QuantityType<?> divide(QuantityType<?> state); QuantityType<T> offset(QuantityType<T> offset, Unit<T> unit); static final QuantityType<Dimensionless> ZERO; static final QuantityType<Dimensionless> ONE; }
@Test public void testMultiplyQuantityType() { assertThat(new QuantityType<>("2 m").multiply(new QuantityType<>("4 cm")), is(new QuantityType<>("8 m·cm"))); }