Class FloatTypeHandler

  • All Implemented Interfaces:
    java.lang.Cloneable, ConfigurableTypeHandler, TypeHandler

    public class FloatTypeHandler
    extends NumberTypeHandler
    A type handler implementation for the Float class. If pattern is set, a DecimalFormat is used to parse and format the value. Otherwise, the value is parsed and formatted using the Float class.
    Since:
    1.0
    • Constructor Detail

      • FloatTypeHandler

        public FloatTypeHandler()
    • Method Detail

      • createNumber

        protected java.lang.Float createNumber​(java.lang.String text)
                                        throws java.lang.NumberFormatException
        Description copied from class: NumberTypeHandler
        Parses a Number from text.
        Specified by:
        createNumber in class NumberTypeHandler
        Parameters:
        text - the text to convert to a Number
        Returns:
        the parsed Number
        Throws:
        java.lang.NumberFormatException - if the text is not a valid number
      • createNumber

        protected java.lang.Float createNumber​(java.math.BigDecimal bg)
                                        throws java.lang.ArithmeticException
        Description copied from class: NumberTypeHandler
        Parses a Number from a BigDecimal.
        Specified by:
        createNumber in class NumberTypeHandler
        Parameters:
        bg - the BigDecimal version of the number
        Returns:
        the parsed Number
        Throws:
        java.lang.ArithmeticException - if the BigDecimal cannot be converted to the Number type supported by this handler
      • getType

        public java.lang.Class<?> getType()
        Description copied from interface: TypeHandler
        Returns the class type supported by this handler. Primitive types should not be returned by this method- use the object equivalent instead.
        Returns:
        the class type supported by this handler