class DoubleConverter implements PropertyConverter<Double> {

    @Override
    public Double convert(String value, ConversionContext ctx) {
        ctx.addSupportedFormats(getClass(), "<double>", "MIN", "MIN_VALUE", "MAX", "MAX_VALUE",
                "POSITIVE_INFINITY", "NEGATIVE_INFINITY", "NAN");
        if(value==null){
            return null;
        }
        String trimmed = value.trim();
        switch (trimmed.toUpperCase(Locale.ENGLISH)) {
            case "POSITIVE_INFINITY":
                return Double.POSITIVE_INFINITY;
            case "NEGATIVE_INFINITY":
                return Double.NEGATIVE_INFINITY;
            case "NAN":
                return Double.NaN;
            case "MIN_VALUE":
            case "MIN":
                return Double.MIN_VALUE;
            case "MAX_VALUE":
            case "MAX":
                return Double.MAX_VALUE;
            default:
                try {
                    return Double.valueOf(trimmed);
                } catch (Exception e) {
                    // OK perhaps we have an integral number that must be converted to the double type...
                    LOG.finest("Parsing of double as floating number failed, trying parsing integral" +
                            " number/hex instead...");
                }
                Long val = integerConverter.convert(trimmed, ctx);
                if(val!=null){
                    return val.doubleValue();
                }
                return null;
        }

    }

}