Code example for DecimalFormat

Methods: applyPattern, parse, setParseBigDecimal

0
                   desiredClassName.equals(BigDecimal.class.getName())) {
 
            if (StringUtils.isEmpty(paramValue[0])) throw new EmptyNumberException();
 
            DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(new Locale(LocaleManager.currentLang()));
            if (desiredClassName.equals(BigDecimal.class.getName())) df.setParseBigDecimal(true);
            String pattern = field.getFieldPattern();
            if (pattern != null && !"".equals(pattern)) {
                df.applyPattern(pattern);
            } else { 
                df.applyPattern("###.##");
            } 
            ParsePosition pp = new ParsePosition(0);
            Number num = df.parse(paramValue[0], pp);            
            if (paramValue[0].length() != pp.getIndex() || num == null) {
                log.debug("Error on parsing value");
                throw new ParseException("Error parsing value", pp.getIndex());
            } 
 
            if (desiredClassName.equals(BigDecimal.class.getName())) {
                return num;