|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.morph.transform.support.NumberRounder
public abstract class NumberRounder
Field Summary | |
---|---|
static java.lang.String |
ROUND_CEILING
Rounding mode specified in BigDecimal . |
static java.lang.String |
ROUND_DOWN
Rounding mode specified in BigDecimal . |
static java.lang.String |
ROUND_FLOOR
Rounding mode specified in BigDecimal . |
static java.lang.String |
ROUND_HALF_DOWN
Rounding mode specified in BigDecimal . |
static java.lang.String |
ROUND_HALF_EVEN
Rounding mode specified in BigDecimal . |
static java.lang.String |
ROUND_HALF_UP
Rounding mode specified in BigDecimal . |
static java.lang.String |
ROUND_UP
Rounding mode specified in BigDecimal . |
Constructor Summary | |
---|---|
NumberRounder()
|
Method Summary | |
---|---|
static int |
getBigDecimalRoundMode(java.lang.String mode)
Converts a rounding mode defined in this class to one of the rounding mode int s specified in the BigDecimal class. |
static java.lang.Number |
round(java.lang.Number number,
java.lang.String mode)
Rounds the given number using the given rounding mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ROUND_CEILING
BigDecimal
.
BigDecimal.ROUND_CEILING
,
Constant Field Valuespublic static final java.lang.String ROUND_DOWN
BigDecimal
.
BigDecimal.ROUND_DOWN
,
Constant Field Valuespublic static final java.lang.String ROUND_FLOOR
BigDecimal
.
BigDecimal.ROUND_FLOOR
,
Constant Field Valuespublic static final java.lang.String ROUND_HALF_DOWN
BigDecimal
.
BigDecimal.ROUND_HALF_DOWN
,
Constant Field Valuespublic static final java.lang.String ROUND_HALF_EVEN
BigDecimal
.
BigDecimal.ROUND_HALF_EVEN
,
Constant Field Valuespublic static final java.lang.String ROUND_HALF_UP
BigDecimal
.
BigDecimal.ROUND_HALF_UP
,
Constant Field Valuespublic static final java.lang.String ROUND_UP
BigDecimal
.
BigDecimal.ROUND_UP
,
Constant Field ValuesConstructor Detail |
---|
public NumberRounder()
Method Detail |
---|
public static int getBigDecimalRoundMode(java.lang.String mode) throws java.lang.IllegalArgumentException
int
s specified in the BigDecimal
class.
mode
- the String representation of the mode, as defined in one of
the constants of this class
BigDecimal
class.
java.lang.IllegalArgumentException
- if an invalid rounding mode was specifiedpublic static java.lang.Number round(java.lang.Number number, java.lang.String mode) throws java.lang.IllegalArgumentException
number
- the number to roundmode
- the rounding mode, as specified by one of the constants in
this class
null
, if number
is
null
or number
rounded as requested, otherwise
java.lang.IllegalArgumentException
- if an invalid rounding mode is specified
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |