All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avides.xpath.utils.converters.ToIntegerConverter Maven / Gradle / Ivy

The newest version!
package com.avides.xpath.utils.converters;

import java.util.function.Function;

/**
 * A converter ({@link java.util.function.Function Function}) that converts to a
 * {@link java.lang.Integer Integer}. If the value is null,
 * null is returned. If the value can not be converted to an
 * {@link java.lang.Integer Integer}, a {@link java.lang.NumberFormatException}
 * is thrown. Values are trimmed before conversion.
 *
 * @author Martin Schumacher
 * @since 1.0.0.RELEASE
 */
public class ToIntegerConverter implements Function
{
    @Override
    public Integer apply(String t)
    {
        return t != null ? Integer.valueOf(t.trim()) : null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy