class FloatConverter implements PropertyConverter<Float> {

    @Override
    public Float convert(String value, ConversionContext ctx) {
        ctx.addSupportedFormats(getClass(), "<float>", "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 Float.POSITIVE_INFINITY;
            case "NEGATIVE_INFINITY":
                return Float.NEGATIVE_INFINITY;
            case "NAN":
                return Float.NaN;
            case "MIN_VALUE":
            case "MIN":
                return Float.MIN_VALUE;
            case "MAX_VALUE":
            case "MAX":
                return Float.MAX_VALUE;
            default:
                try {
                    return Float.valueOf(trimmed);
                } catch(Exception e){
                    // OK perhaps we have an integral number that must be converted to the double type...
                    LOG.finest("Parsing of float as floating number failed, trying parsing integral" +
                            " number/hex instead...");
                }
                Integer val = integerConverter.convert(trimmed, ctx);
                if(val!=null) {
                    return val.floatValue();
                }
                LOG.finest("Unparseable float createValue: " + trimmed);
                return null;
        }
    }

}