Class AmountResolver


  • public class AmountResolver
    extends java.lang.Object
    Helper API to detect amount component in fields.
    • Constructor Summary

      Constructors 
      Constructor Description
      AmountResolver()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.math.BigDecimal amount​(Field f)
      Gets the amount of the given field by reading it's components pattern.
      static java.util.List<java.math.BigDecimal> amounts​(Field f)
      Gets the amounts of the given field by reading it's components pattern.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AmountResolver

        public AmountResolver()
    • Method Detail

      • amounts

        public static java.util.List<java.math.BigDecimal> amounts​(Field f)
        Gets the amounts of the given field by reading it's components pattern. All index of 'I', number, in the pattern are looked for and returned as amount. See the returns notes
        Parameters:
        f - the field where to extract the amounts, must not be null
        Returns:
        a list of BigDecimal with the numbers found in the numeric components or an empty list if none is found. Missing or invalid numeric components are ignored; meaning if a components expected to be a number is not present or it is not a valid number or Field.getComponent(index,Number.class) fails, that component is not included in the result list.
        Since:
        7.8.9
      • amount

        public static java.math.BigDecimal amount​(Field f)
        Gets the amount of the given field by reading it's components pattern. The first index of 'N', number, is returned as amount. See the returns notes
        Parameters:
        f - the field where to extract the amount, must not be null
        Returns:
        a BigDecimal with the number found in the first numeric component or null if there is no numeric component in the field. It may also return null if Field.getComponent(index,Number.class) fails for that component
        Since:
        7.8