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

it.espr.mvc.converter.StringToIntegerConverter Maven / Gradle / Ivy

package it.espr.mvc.converter;

import it.espr.injector.Utils;

public class StringToIntegerConverter implements StringToTypeConverter {

	@Override
	public Class getType() {
		return Integer.class;
	}

	@Override
	public Integer convert(String value) throws StringToTypeConverterException {
		try {
			if (!Utils.isEmpty(value)) {
				return Integer.parseInt(value);
			}
		} catch (Exception e) {
			throw new StringToTypeConverterException("Couldn't parse value '" + value + "'", e);
		}
		return null;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy