|
|||||||||||||||||||
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 | |||||||||||||||
AbstractLongData.java | 0% | 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.BigInteger; |
|
13 |
|
|
14 |
import org.jbind.xml.core.data.ILongData; |
|
15 |
import org.jbind.xml.msg.XmlException; |
|
16 |
import org.jbind.xml.msg.XmlMessages; |
|
17 |
|
|
18 |
public abstract class AbstractLongData extends AbstractIntegerData implements ILongData { |
|
19 |
|
|
20 |
private final static BigInteger ourMaxLong = new BigInteger(Long.toString(Long.MAX_VALUE)); |
|
21 |
private final static BigInteger ourMinLong = new BigInteger(Long.toString(Long.MIN_VALUE)); |
|
22 |
|
|
23 | 0 |
public BigInteger getBigInteger() { |
24 | 0 |
return new BigInteger(getCanonicalForm_()); |
25 |
} |
|
26 |
|
|
27 | 0 |
public void setBigInteger(BigInteger aValue) throws XmlException { |
28 | 0 |
if (aValue.compareTo(ourMaxLong) > 0) { |
29 | 0 |
throw new XmlException(XmlMessages.numberTooLarge(String.valueOf(aValue), null)); |
30 |
} |
|
31 | 0 |
if (aValue.compareTo(ourMinLong) < 0) { |
32 | 0 |
throw new XmlException(XmlMessages.numberTooSmall(String.valueOf(aValue), null)); |
33 |
} |
|
34 | 0 |
setLong(aValue.longValue()); |
35 |
} |
|
36 |
} |
|
37 |
|
|