Enum NumberFormatOptions.RoundingMode
- java.lang.Object
-
- java.lang.Enum<NumberFormatOptions.RoundingMode>
-
- de.xima.fc.form.common.number_format.NumberFormatOptions.RoundingMode
-
- All Implemented Interfaces:
com.alibaba.fastjson.serializer.JSONSerializable
,Serializable
,Comparable<NumberFormatOptions.RoundingMode>
- Enclosing class:
- NumberFormatOptions
public static enum NumberFormatOptions.RoundingMode extends Enum<NumberFormatOptions.RoundingMode> implements com.alibaba.fastjson.serializer.JSONSerializable
The mode to use when rounding numbers. Available values are:
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AWAY_FROM_ZERO
Round up (round away from zero)DOWN_05
Rounds down to next .05HALF_DOWN_ASYMMETRIC
Round half down, asymmetricHALF_DOWN_SYMMETRIC
Round half down, symmetricHALF_EVEN
Round half even (banker's rounding)HALF_UP_ASYMMETRIC
Round half up, asymmetricHALF_UP_SYMMETRIC
Round half up, symmetricNEAREST_05
Rounds up to nearest .05TOWARD_NEGATIVE_INFINITY
Round to floor (toward negative infinity)TOWARD_POSITIVE_INFINITY
Round to ceiling (toward positive infinity)TOWARD_ZERO
Round down (round toward zero, same as truncating)UP_05
Rounds down to next .05
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NumberFormatOptions.RoundingMode
fromString(String value)
Finds the enum constant corresponding to the given string value, seevalue()
.String
toString()
String
value()
Gets the string value of this rounding mode.static NumberFormatOptions.RoundingMode
valueOf(String name)
Returns the enum constant of this type with the specified name.static NumberFormatOptions.RoundingMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.void
write(com.alibaba.fastjson.serializer.JSONSerializer serializer, Object fieldName, Type fieldType, int features)
-
-
-
Enum Constant Detail
-
HALF_UP_SYMMETRIC
public static final NumberFormatOptions.RoundingMode HALF_UP_SYMMETRIC
Round half up, symmetric
-
HALF_UP_ASYMMETRIC
public static final NumberFormatOptions.RoundingMode HALF_UP_ASYMMETRIC
Round half up, asymmetric
-
HALF_DOWN_SYMMETRIC
public static final NumberFormatOptions.RoundingMode HALF_DOWN_SYMMETRIC
Round half down, symmetric
-
HALF_DOWN_ASYMMETRIC
public static final NumberFormatOptions.RoundingMode HALF_DOWN_ASYMMETRIC
Round half down, asymmetric
-
HALF_EVEN
public static final NumberFormatOptions.RoundingMode HALF_EVEN
Round half even (banker's rounding)
-
AWAY_FROM_ZERO
public static final NumberFormatOptions.RoundingMode AWAY_FROM_ZERO
Round up (round away from zero)
-
TOWARD_ZERO
public static final NumberFormatOptions.RoundingMode TOWARD_ZERO
Round down (round toward zero, same as truncating)
-
TOWARD_POSITIVE_INFINITY
public static final NumberFormatOptions.RoundingMode TOWARD_POSITIVE_INFINITY
Round to ceiling (toward positive infinity)
-
TOWARD_NEGATIVE_INFINITY
public static final NumberFormatOptions.RoundingMode TOWARD_NEGATIVE_INFINITY
Round to floor (toward negative infinity)
-
NEAREST_05
public static final NumberFormatOptions.RoundingMode NEAREST_05
Rounds up to nearest .05
-
UP_05
public static final NumberFormatOptions.RoundingMode UP_05
Rounds down to next .05
-
DOWN_05
public static final NumberFormatOptions.RoundingMode DOWN_05
Rounds down to next .05
-
-
Method Detail
-
values
public static NumberFormatOptions.RoundingMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (NumberFormatOptions.RoundingMode c : NumberFormatOptions.RoundingMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static NumberFormatOptions.RoundingMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
toString
public String toString()
- Overrides:
toString
in classEnum<NumberFormatOptions.RoundingMode>
-
value
public String value()
Gets the string value of this rounding mode.- Returns:
- The string value of this rounding mode.
-
write
public void write(com.alibaba.fastjson.serializer.JSONSerializer serializer, Object fieldName, Type fieldType, int features) throws IOException
- Specified by:
write
in interfacecom.alibaba.fastjson.serializer.JSONSerializable
- Throws:
IOException
-
fromString
public static NumberFormatOptions.RoundingMode fromString(String value)
Finds the enum constant corresponding to the given string value, seevalue()
.- Parameters:
value
- The string value to find the enum constant for.- Returns:
- The enum constant corresponding to the given string value, or
null
if no such constant exists.
-
-