Class FloatTransformer

  • All Implemented Interfaces:
    Transformer, Validator

    public class FloatTransformer
    extends AbstractDecimalTransformer<Float>

    A specialized number transformer implementation that deals with numbers of type java.lang.Float.

    This class implements the abstract methods defined by its super classes in a way suitable for java.lang.Float objects. It does not define any new properties or error messages. Refer to the documentation of NumberTransformerBase for a list of all supported properties and possible error messages.

    Version:
    $Id: FloatTransformer.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • FloatTransformer

        public FloatTransformer()
    • Method Detail

      • convert

        protected Float convert​(Number n)
        Converts the specified number into a Float. If the number exceeds the value range of a float, an exception is thrown.
        Specified by:
        convert in class NumberTransformerBase<Float>
        Parameters:
        n - the number to convert
        Returns:
        the converted number
        Throws:
        IllegalArgumentException - if the number cannot be converted
      • fetchProperty

        protected Float fetchProperty​(org.apache.commons.configuration.Configuration config,
                                      String property,
                                      Float defaultValue)
        Fetches a float property from the specified configuration.
        Specified by:
        fetchProperty in class NumberTransformerBase<Float>
        Parameters:
        config - the configuration
        property - the property
        defaultValue - the default value
        Returns:
        the value of this property