diff options
Diffstat (limited to 'src/org/unitConverter/unit/UnitValue.java')
-rw-r--r-- | src/org/unitConverter/unit/UnitValue.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/org/unitConverter/unit/UnitValue.java b/src/org/unitConverter/unit/UnitValue.java index 8932ccc..c138332 100644 --- a/src/org/unitConverter/unit/UnitValue.java +++ b/src/org/unitConverter/unit/UnitValue.java @@ -70,15 +70,16 @@ public final class UnitValue { } /** - * Returns a UnitValue that represents the same value expressed in a - * different unit + * Returns a UnitlikeValue that represents the same value expressed in a + * different unitlike form. * * @param other new unit to express value in * @return value expressed in {@code other} */ - public final UnitValue convertTo(Unit other) { - return UnitValue.of(other, - this.getUnit().convertTo(other, this.getValue())); + public final <U extends Unitlike<W>, W> UnitlikeValue<U, W> convertTo( + U other) { + return UnitlikeValue.of(other, + this.unit.convertTo(other, this.getValue())); } /** @@ -88,8 +89,8 @@ public final class UnitValue { * @param other new unit to express value in * @return value expressed in {@code other} */ - public final <W> UnitlikeValue<W> convertTo(Unitlike<W> other) { - return UnitlikeValue.of(other, + public final UnitValue convertTo(Unit other) { + return UnitValue.of(other, this.getUnit().convertTo(other, this.getValue())); } |