(Object initValue)
| 65 | } |
| 66 | |
| 67 | private void init(Object initValue) { |
| 68 | if (initValue instanceof Decimal) { |
| 69 | Decimal value = (Decimal) initValue; |
| 70 | bigDecimal = ToolClone.clone(value.getBigDecimal()); |
| 71 | } else if (initValue instanceof BigDecimal) { |
| 72 | bigDecimal = ToolClone.clone((BigDecimal) initValue); |
| 73 | } else if (initValue instanceof BigInteger) { |
| 74 | BigInteger value = (BigInteger) initValue; |
| 75 | bigDecimal = new BigDecimal(ToolClone.clone(value), mathContext); |
| 76 | } else if (initValue instanceof Number) { |
| 77 | Number value = (Number) initValue; |
| 78 | bigDecimal = new BigDecimal(value.toString(), mathContext); |
| 79 | } else if (initValue instanceof String) { |
| 80 | String value = (String) initValue; |
| 81 | bigDecimal = new BigDecimal(value, mathContext); |
| 82 | } else if (initValue == null) { |
| 83 | bigDecimal = new BigDecimal(0, mathContext); |
| 84 | } else { |
| 85 | throw new UnsupportedOperationException("初始化Decimal失败,传入值为" + ToolJson.anyToJson(initValue)); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | |
| 90 | //endregion |
no test coverage detected