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:
- Since:
- 8.2.2
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRound up (round away from zero)Rounds down to next .05Round half down, asymmetricRound half down, symmetricRound half even (banker's rounding)Round half up, asymmetricRound half up, symmetricRounds up to nearest .05Round to floor (toward negative infinity)Round to ceiling (toward positive infinity)Round down (round toward zero, same as truncating)Rounds down to next .05 -
Method Summary
Modifier and TypeMethodDescriptionfromString(String value) Finds the enum constant corresponding to the given string value, seevalue().toString()value()Gets the string value of this rounding mode.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.voidwrite(com.alibaba.fastjson.serializer.JSONSerializer serializer, Object fieldName, Type fieldType, int features)
-
Enum Constant Details
-
HALF_UP_SYMMETRIC
Round half up, symmetric -
HALF_UP_ASYMMETRIC
Round half up, asymmetric -
HALF_DOWN_SYMMETRIC
Round half down, symmetric -
HALF_DOWN_ASYMMETRIC
Round half down, asymmetric -
HALF_EVEN
Round half even (banker's rounding) -
AWAY_FROM_ZERO
Round up (round away from zero) -
TOWARD_ZERO
Round down (round toward zero, same as truncating) -
TOWARD_POSITIVE_INFINITY
Round to ceiling (toward positive infinity) -
TOWARD_NEGATIVE_INFINITY
Round to floor (toward negative infinity) -
NEAREST_05
Rounds up to nearest .05 -
UP_05
Rounds down to next .05 -
DOWN_05
Rounds down to next .05
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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
- Overrides:
toStringin classEnum<NumberFormatOptions.RoundingMode>
-
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:
writein interfacecom.alibaba.fastjson.serializer.JSONSerializable- Throws:
IOException
-
fromString
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
nullif no such constant exists.
-