Exemplo n.º 1
0
 public long longValue(Unit<IMoney> unit) throws ArithmeticException {
   Unit<IMoney> myUnit = unit();
   try {
     UnitConverter converter = unit.getConverterToAny(myUnit);
     return (converter.convert(BigDecimal.valueOf(super.getNumber().longValue())).longValue());
   } catch (UnconvertibleException e) {
     throw e;
   } catch (IncommensurableException e) {
     throw new IllegalArgumentException(e.getMessage());
   }
 }
Exemplo n.º 2
0
 public double doubleValue(Unit<IMoney> unit) {
   Unit<IMoney> myUnit = unit();
   try {
     UnitConverter converter = unit.getConverterToAny(myUnit);
     return converter.convert(getNumber().doubleValue());
   } catch (UnconvertibleException e) {
     throw e;
   } catch (IncommensurableException e) {
     throw new IllegalArgumentException(e.getMessage());
   }
 }