| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.util.json; |
| 7 |
|
| 8 |
import java.math.BigDecimal; |
| 9 |
|
| 10 |
/** |
| 11 |
* JSON number. |
| 12 |
*/ |
| 13 |
public final class JSONNumber extends JSONValue { |
| 14 |
|
| 15 |
private final BigDecimal value; |
| 16 |
|
| 17 |
JSONNumber(BigDecimal value) { |
| 18 |
this.value = value; |
| 19 |
} |
| 20 |
|
| 21 |
@Override |
| 22 |
public void addTo(JSONTarget<?> target) { |
| 23 |
target.valueNumber(value); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Returns the value. |
| 28 |
* |
| 29 |
* @return the value |
| 30 |
*/ |
| 31 |
public BigDecimal getBigDecimal() { |
| 32 |
return value; |
| 33 |
} |
| 34 |
|
| 35 |
} |