jpaoletti.jpm.converter.ShowBooleanConverter Maven / Gradle / Ivy
The newest version!
package jpaoletti.jpm.converter;
import jpaoletti.jpm.core.PMContext;
/**Converter for showing a boolean value.
*
* {@code
*
*
*
*
*
*
* }
*
* @author jpaoletti
* */
public class ShowBooleanConverter extends Converter {
@Override
public String visualize(PMContext ctx) throws ConverterException {
if (!(ctx.getFieldValue() instanceof Boolean)) {
throw new ConverterException("boolean.converter.invalid.value");
}
final String result = ((Boolean) ctx.getFieldValue())
? getPm().message(getConfig("true-text", "pm.converter.boolean_converter.yes"))
: getPm().message(getConfig("false-text", "pm.converter.boolean_converter.no"));
ctx.setFieldValue(result);
return visualize(result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy