|
|||||||||||||||||||
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
AbstractIntegerData.java | - | 0% | 0% | 0% |
|
1 |
/* |
|
2 |
* JBind |
|
3 |
* |
|
4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
5 |
* |
|
6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
8 |
* 'Apache Software License V 1.1'. |
|
9 |
*/ |
|
10 |
package org.jbind.xml.instance.data; |
|
11 |
|
|
12 |
import java.math.BigDecimal; |
|
13 |
|
|
14 |
import org.jbind.xml.core.data.IIntegerData; |
|
15 |
import org.jbind.xml.msg.XmlException; |
|
16 |
import org.jbind.xml.msg.XmlMessages; |
|
17 |
|
|
18 |
public abstract class AbstractIntegerData extends AbstractDecimalData implements IIntegerData { |
|
19 |
|
|
20 | 0 |
public BigDecimal getBigDecimal() { |
21 | 0 |
return new BigDecimal(getBigInteger()); |
22 |
} |
|
23 |
|
|
24 | 0 |
public void setBigDecimal(BigDecimal aValue) throws XmlException { |
25 | 0 |
try { |
26 | 0 |
aValue.setScale(0, BigDecimal.ROUND_UNNECESSARY); |
27 |
} catch (ArithmeticException e) { |
|
28 | 0 |
throw new XmlException(XmlMessages.numberMustHaveNoFractionDigits(aValue, null)); |
29 |
} |
|
30 | 0 |
setBigInteger(aValue.toBigInteger()); |
31 |
} |
|
32 |
} |
|
33 |
|
|