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

org.stagemonitor.configuration.converter.BooleanValueConverter Maven / Gradle / Ivy

There is a newer version: 1.50.0
Show newest version
package org.stagemonitor.configuration.converter;

public class BooleanValueConverter extends AbstractValueConverter {

	public static final BooleanValueConverter INSTANCE = new BooleanValueConverter();

	private static final String TRUE = Boolean.TRUE.toString();
	private static final String FALSE = Boolean.FALSE.toString();

	@Override
	public Boolean convert(String s) {
		if (TRUE.equals(s) || FALSE.equals(s)) {
			return Boolean.valueOf(s);
		}
		throw new IllegalArgumentException("Can't convert '" + s + "' to Boolean.");
	}

	@Override
	public String toString(Boolean value) {
		if (value == null) {
			return null;
		}
		return String.valueOf(value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy