Class IntegerTransformer

  • All Implemented Interfaces:
    Transformer, Validator

    public class IntegerTransformer
    extends AbstractIntegerTransformer<Integer>

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

    This class implements the abstract methods defined by its super classes in a way suitable for java.lang.Integer 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: IntegerTransformer.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • IntegerTransformer

        public IntegerTransformer()
    • Method Detail

      • convert

        protected Integer convert​(Number n)
        Converts the given number to an java.lang.Integer. We also check whether the number fits into the value range supported by integers.
        Specified by:
        convert in class NumberTransformerBase<Integer>
        Parameters:
        n - the number to convert
        Returns:
        the converted number
        Throws:
        IllegalArgumentException - if the number cannot be converted
      • fetchProperty

        protected Integer fetchProperty​(org.apache.commons.configuration.Configuration config,
                                        String property,
                                        Integer defaultValue)
        Fetches a configuration property of type integer.
        Specified by:
        fetchProperty in class NumberTransformerBase<Integer>
        Parameters:
        config - the configuration
        property - the property to fetch
        defaultValue - the default value
        Returns:
        the property from the configuration