ru.yandex.qatools.properties.converters.CharsetConverter Maven / Gradle / Ivy
The newest version!
package ru.yandex.qatools.properties.converters;
import org.apache.commons.beanutils.converters.AbstractConverter;
import java.nio.charset.Charset;
/**
* @author Dmitry Baev [email protected]
* Date: 26.03.15
*/
public class CharsetConverter extends AbstractConverter {
@Override
protected T convertToType(Class type, Object value) throws Throwable {
if (Charset.class.equals(type)) {
return type.cast(Charset.forName(value.toString()));
}
throw conversionException(type, value);
}
@Override
protected Class getDefaultType() {
return Charset.class;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy