Java BigDecimal Parse parseBigDecimal(Object value)

Here you can find the source of parseBigDecimal(Object value)

Description

parse Big Decimal

License

Open Source License

Declaration

public static BigDecimal parseBigDecimal(Object value) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;

public class Main {
    public static BigDecimal parseBigDecimal(Object value) {
        if (value == null || value.toString().isEmpty()) {
            return null;
        } else {/* w  w w.j a va2 s .  com*/
            try {
                Double check = Double.parseDouble(value.toString());
                return new BigDecimal(check);
            } catch (NumberFormatException e) {
                return null;
            }
        }
    }

    public static Double parseDouble(Object value) {
        if (value == null || value.toString().isEmpty()) {
            return null;
        } else {
            try {
                return Double.parseDouble(value.toString());
            } catch (NumberFormatException e) {
                return null;
            }
        }
    }
}

Related

  1. isIntegerBigDecimal(BigDecimal bd)
  2. isIntegerValue(final BigDecimal bd)
  3. parseBigDecimal(Object o, BigDecimal defaulti)
  4. parseBigDecimal(Object obj)
  5. parseBigDecimal(Object value)
  6. parseBigDecimal(String data)
  7. parseBigDecimal(String inString, BigDecimal inDefault)
  8. parseBigDecimal(String number, BigDecimal defValue)
  9. parseBigDecimalForEntity(String bigDecimalString)