org.jopendocument.util.convertor
Class NumberConvertor<T extends Number,U extends Number>
java.lang.Object
org.jopendocument.util.convertor.NumberConvertor<T,U>
- All Implemented Interfaces:
- ValueConvertor<T,U>
public abstract class NumberConvertor<T extends Number,U extends Number>
- extends Object
- implements ValueConvertor<T,U>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INT_TO_LONG
public static final NumberConvertor<Integer,Long> INT_TO_LONG
SHORT_TO_INT
public static final NumberConvertor<Short,Integer> SHORT_TO_INT
MAX_FLOAT
public static final BigDecimal MAX_FLOAT
MIN_FLOAT
public static final BigDecimal MIN_FLOAT
MAX_DOUBLE
public static final BigDecimal MAX_DOUBLE
MIN_DOUBLE
public static final BigDecimal MIN_DOUBLE
NumberConvertor
public NumberConvertor()
create
public static final <N1 extends Number,N2 extends Number> NumberConvertor<N1,N2> create(Class<N1> c1,
Class<N2> c2,
boolean exact)
convert
public static <N extends Number> N convert(Number n,
Class<N> clazz)
- Convert from one class of
Number
to another. Necessary since new Integer(123) isn't
equal to new Long(123).
- Type Parameters:
N
- type of desired Number.- Parameters:
n
- the instance to convert, e.g. new Integer(123).clazz
- desired class of Number, e.g. Long.class.
- Returns:
n
as an instance of clazz
, e.g. new Long(123).
toBigDecimal
public static BigDecimal toBigDecimal(Number n)
convertExact
public static <N extends Number> N convertExact(Number n,
Class<N> clazz)
throws NumberConvertor.OverflowException,
NumberConvertor.RoundingException
- Throws:
NumberConvertor.OverflowException
NumberConvertor.RoundingException
Copyright © 2010 jOpenDocument All Rights Reserved.