class StringConverter implements AtlasConverter<String> {

    @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.BOOLEAN, concerns = AtlasConversionConcern.CONVENTION)
    public Boolean toBoolean(String value, String sourceFormat, String targetFormat) {
        if (value == null) {
            return null;
        }

        // string expression of true?
        Pattern pattern;
        if (sourceFormat != null && !sourceFormat.isEmpty()) {
            pattern = Pattern.compile(sourceFormat, Pattern.CASE_INSENSITIVE);
        } else {
            pattern = TRUE_PATTERN;
        }
        if (pattern.matcher(value).matches()) {
            return Boolean.TRUE;
        }

        // then try C like numeric translation
        try {
            Number n = NumberFormat.getInstance().parse(value);
            if (n.intValue() == 0) {
                return Boolean.FALSE;
            }
            return Boolean.TRUE;
        } catch (ParseException e) {
            e.getMessage(); // ignore
        }

        // false by default
        return Boolean.FALSE;
    }

}