class StringConverter implements AtlasConverter<String> {

    @AtlasConversionInfo(sourceType = FieldType.STRING, targetType = FieldType.INTEGER, concerns = {
            AtlasConversionConcern.FORMAT, AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART })
    public Integer toInteger(String value) throws AtlasConversionException {
        if (value == null) {
            return null;
        }

        Integer i = null;
        try {
            i = Integer.parseInt(value);
        } catch (NumberFormatException nfe) {
            try {
                BigDecimal bd = new BigDecimal(value);
                if (bd.compareTo(new BigDecimal(Integer.MIN_VALUE)) < 0
                        || bd.compareTo(new BigDecimal(Integer.MAX_VALUE)) > 0) {
                    throw new AtlasConversionException(String
                            .format("String %s is greater than Integer.MAX_VALUE  or less than Integer.MIN_VALUE", value));
                }
                i = bd.intValue();
            } catch (NumberFormatException nfe2) {
                throw new AtlasConversionException(nfe);
            }
        }

        return i;
    }

}