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

org.srplib.conversion.StringToFloatConverter Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package org.srplib.conversion;

/**
 * Converts {@link String} value to {@link Float} value.
 *
 * @author Q-GMA
 */
public class StringToFloatConverter implements Converter {
    /**
     * Converts string to float.
     *
     * @param input a value to convert.
     * @return Float value.
     * @throws org.srplib.conversion.ConverterException if value can't be converted.
     */
    @Override
    public Float convert(String input) {
        try {
            return Float.valueOf(input);
        }
        catch (NumberFormatException e) {
            throw new ConverterException("Can't convert '" + input + "' to float.", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy