Interface UnitConversionService

All Known Implementing Classes:
DefaultUnitConversionServiceImpl

public interface UnitConversionService
This interface provides methods to convert between the biggest and smallest unit of a token according to the given unit-factor.

When communicating with the protocol it's always necessary to use the value of the smallest unit.

The default-implementation DefaultUnitConversionServiceImpl provides a constructor where the unit-factor can be provided. by default the factor to use for the biggest unit is 18

  • Method Summary

    Modifier and Type Method Description
    java.math.BigDecimal toBiggestUnit​(java.lang.String valueOfSmallestUnit)  
    java.math.BigDecimal toBiggestUnit​(java.math.BigInteger valueOfSmallestUnit)  
    java.math.BigInteger toSmallestUnit​(java.lang.String valueOfBiggestUnit)  
    java.math.BigInteger toSmallestUnit​(java.math.BigDecimal valueOfBiggestUnit)  
  • Method Details

    • toBiggestUnit

      java.math.BigDecimal toBiggestUnit​(java.math.BigInteger valueOfSmallestUnit)
    • toBiggestUnit

      java.math.BigDecimal toBiggestUnit​(java.lang.String valueOfSmallestUnit)
    • toSmallestUnit

      java.math.BigInteger toSmallestUnit​(java.lang.String valueOfBiggestUnit)
    • toSmallestUnit

      java.math.BigInteger toSmallestUnit​(java.math.BigDecimal valueOfBiggestUnit)