Class NumberContainer<T extends Number>

java.lang.Object
com.cryptoalgo.oursql.model.db.data.Container<T>
com.cryptoalgo.oursql.model.db.data.NumberContainer<T>
Type Parameters:
T - Numerical type for the container.
Direct Known Subclasses:
FloatNumberContainer, IntNumberContainer

public abstract class NumberContainer<T extends Number> extends Container<T>
An abstract container to store various numerical SQL types
  • Constructor Details

    • NumberContainer

      public NumberContainer(String boxValue)
      Create an instance of a NumberContainer with a raw value.
      Parameters:
      boxValue - Raw value to unbox into container
  • Method Details

    • getMin

      protected abstract BigDecimal getMin()
      Get the minimum allowable value that can be represented by this numerical type
      Returns:
      Minimum value that can be represented by this numerical type
    • getMax

      protected abstract BigDecimal getMax()
      Get the maximum allowable value that can be represented by this numerical type
      Returns:
      Maximum value that can be represented by this numerical type
    • getBigDecimalValue

      protected abstract BigDecimal getBigDecimalValue(T val)
      Get the BigDecimal representation of a value of the container's boxed type
      Parameters:
      val - A value
      Returns:
      The BigDecimal representation of the value
    • getFinalValue

      public String getFinalValue(@NotNull @NotNull String input)
      Description copied from class: Container
      Get the final value from a user input for committing
      Overrides:
      getFinalValue in class Container<T extends Number>
      Parameters:
      input - Raw input
      Returns:
      Output to be used for the commit operation
    • isValid

      public boolean isValid(@Nullable @Nullable String value)
      Specified by:
      isValid in class Container<T extends Number>
      Parameters:
      value - Value to be checked
      Returns:
      true if value can be cast to the type of this container
    • toString

      public abstract String toString()
      Specified by:
      toString in class Container<T extends Number>