class StringConverter implements AtlasConverter<String> {

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

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

}