Class NumberFormatOptions.Builder
- java.lang.Object
-
- de.xima.fc.form.common.number_format.NumberFormatOptions.Builder
-
- Enclosing class:
- NumberFormatOptions
public static final class NumberFormatOptions.Builder extends Object
A simple builder forNumberFormatOptions.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumberFormatOptions.BuilderapplyDefaultsIfMissing()Apply the defaults for all options that are not set when building the options.NumberFormatOptions.BuilderapplyDefaultsIfMissing(boolean applyDefaultsIfMissing)When set to true, apply the defaults for all options that are not set when building the options.NumberFormatOptionsbuild()Builds a new options instance.NumberFormatOptions.BuilderdecimalPaddingMode(NumberFormatOptions.DecimalPaddingMode decimalPaddingMode)Whether to pad decimals with zeroes, up to the number of decimal places, seedecimalPlaces(int).NumberFormatOptions.BuilderdecimalPlaces(int decimalPlaces)Maximum number of decimal places to display, see alsodecimalPaddingMode(DecimalPaddingMode).NumberFormatOptions.BuilderdecimalSeparator(NumberFormatOptions.DecimalSeparator decimalSeparator)Separator to use to separate the integer part of the number from the fractional part.NumberFormatOptions.BuilderdigitGroupMode(NumberFormatOptions.DigitGroupMode digitGroupMode)How to group digits in the integer part of the number.NumberFormatOptions.BuilderdigitGroupSeparator(NumberFormatOptions.DigitGroupSeparator digitGroupSeparator)Separator to use between digit groups.NumberFormatOptions.BuilderemptyMode(NumberFormatOptions.EmptyMode emptyMode)Defines the behavior of the input field when it is empty.NumberFormatOptions.BuilderitemProperties(IXItemPropertiesData itemProperties)Reads the number format options from the given item properties and sets them on this builder.NumberFormatOptions.BuilderleadingZeroMode(NumberFormatOptions.LeadingZeroMode leadingZeroMode)Defines how to treat leading zeroes, e.g.NumberFormatOptions.BuildernegativeSign(char negativeSign)The sign used to indicate that a number is negative.NumberFormatOptions.BuilderpositiveSign(char positiveSign)The sign used to indicate that a number is positive.NumberFormatOptions.BuilderroundingMode(NumberFormatOptions.RoundingMode roundingMode)The mode to use when rounding numbers.NumberFormatOptions.BuildershowPositiveSign()Show the positive sign for positive numbers.NumberFormatOptions.BuildershowPositiveSign(boolean showPositiveSign)Whether to show the positive sign for positive numbers.NumberFormatOptions.BuildersignumSignPlacement(NumberFormatOptions.SignumSignPlacement signumSignPlacement)Where to place the signum sign that indicates whether a number is positive or negative.NumberFormatOptions.BuilderunitSign(String unitSign)The unit sign to show before or after the number, seeunitSignPlacement(UnitSignPlacement).NumberFormatOptions.BuilderunitSignPlacement(NumberFormatOptions.UnitSignPlacement unitSignPlacement)Where to place theunit sign, if any.
-
-
-
Method Detail
-
applyDefaultsIfMissing
@CanIgnoreReturnValue public NumberFormatOptions.Builder applyDefaultsIfMissing()
Apply the defaults for all options that are not set when building the options.- Returns:
- This builder for chaining method calls.
-
applyDefaultsIfMissing
@CanIgnoreReturnValue public NumberFormatOptions.Builder applyDefaultsIfMissing(boolean applyDefaultsIfMissing)
When set to true, apply the defaults for all options that are not set when building the options.- Parameters:
applyDefaultsIfMissing- Whether to apply defaults for missing options.- Returns:
- This builder for chaining method calls.
-
build
public NumberFormatOptions build()
Builds a new options instance. Subsequent modifications to this builder will not affect the returned instance.- Returns:
- A new options instance.
-
decimalPaddingMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder decimalPaddingMode(NumberFormatOptions.DecimalPaddingMode decimalPaddingMode)
Whether to pad decimals with zeroes, up to the number of decimal places, seedecimalPlaces(int).- Parameters:
decimalPaddingMode- The decimal padding mode.- Returns:
- This builder for chaining method calls.
-
decimalPlaces
@CanIgnoreReturnValue public NumberFormatOptions.Builder decimalPlaces(int decimalPlaces)
Maximum number of decimal places to display, see alsodecimalPaddingMode(DecimalPaddingMode).- Parameters:
decimalPlaces- The number of decimal places.- Returns:
- This builder for chaining method calls.
-
decimalSeparator
@CanIgnoreReturnValue public NumberFormatOptions.Builder decimalSeparator(NumberFormatOptions.DecimalSeparator decimalSeparator)
Separator to use to separate the integer part of the number from the fractional part.- Parameters:
decimalSeparator- The decimal separator to use.- Returns:
- This builder for chaining method calls.
-
digitGroupMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder digitGroupMode(NumberFormatOptions.DigitGroupMode digitGroupMode)
How to group digits in the integer part of the number.- Parameters:
digitGroupMode- The digit group mode.- Returns:
- This builder for chaining method calls.
-
digitGroupSeparator
@CanIgnoreReturnValue public NumberFormatOptions.Builder digitGroupSeparator(NumberFormatOptions.DigitGroupSeparator digitGroupSeparator)
Separator to use between digit groups.- Parameters:
digitGroupSeparator- The digit group separator.- Returns:
- This builder for chaining method calls.
-
emptyMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder emptyMode(NumberFormatOptions.EmptyMode emptyMode)
Defines the behavior of the input field when it is empty.- Parameters:
emptyMode- The empty mode.- Returns:
- This builder for chaining method calls.
-
itemProperties
@CanIgnoreReturnValue public NumberFormatOptions.Builder itemProperties(IXItemPropertiesData itemProperties)
Reads the number format options from the given item properties and sets them on this builder.- Parameters:
itemProperties- The item properties to read the options from.- Returns:
- This builder for chaining method calls.
-
leadingZeroMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder leadingZeroMode(NumberFormatOptions.LeadingZeroMode leadingZeroMode)
Defines how to treat leading zeroes, e.g. `003512`.- Parameters:
leadingZeroMode- The leading zero mode.- Returns:
- This builder for chaining method calls.
-
negativeSign
@CanIgnoreReturnValue public NumberFormatOptions.Builder negativeSign(char negativeSign)
The sign used to indicate that a number is negative. Must be a single character. Must not be any of the numerical characters (digits).- Parameters:
negativeSign- The negative sign.- Returns:
- This builder for chaining method calls.
-
positiveSign
@CanIgnoreReturnValue public NumberFormatOptions.Builder positiveSign(char positiveSign)
The sign used to indicate that a number is positive. Must be a single character. Must not be any of the numerical characters (digits).- Parameters:
positiveSign- The positive sign.- Returns:
- This builder for chaining method calls.
-
roundingMode
@CanIgnoreReturnValue public NumberFormatOptions.Builder roundingMode(NumberFormatOptions.RoundingMode roundingMode)
The mode to use when rounding numbers.- Parameters:
roundingMode- The rounding mode.- Returns:
- This builder for chaining method calls.
-
showPositiveSign
@CanIgnoreReturnValue public NumberFormatOptions.Builder showPositiveSign()
Show the positive sign for positive numbers.- Returns:
- This builder for chaining method calls.
-
showPositiveSign
@CanIgnoreReturnValue public NumberFormatOptions.Builder showPositiveSign(boolean showPositiveSign)
Whether to show the positive sign for positive numbers.- Parameters:
showPositiveSign- Whether to show the positive sign.- Returns:
- This builder for chaining method calls.
-
signumSignPlacement
@CanIgnoreReturnValue public NumberFormatOptions.Builder signumSignPlacement(NumberFormatOptions.SignumSignPlacement signumSignPlacement)
Where to place the signum sign that indicates whether a number is positive or negative. See alsonegative signandpositive sign.- Parameters:
signumSignPlacement- The signum sign placement.- Returns:
- This builder for chaining method calls.
-
unitSign
@CanIgnoreReturnValue public NumberFormatOptions.Builder unitSign(String unitSign)
The unit sign to show before or after the number, seeunitSignPlacement(UnitSignPlacement).- Parameters:
unitSign- The unit sign.- Returns:
- This builder for chaining method calls.
-
unitSignPlacement
@CanIgnoreReturnValue public NumberFormatOptions.Builder unitSignPlacement(NumberFormatOptions.UnitSignPlacement unitSignPlacement)
Where to place theunit sign, if any.- Parameters:
unitSignPlacement- The unit sign placement.- Returns:
- This builder for chaining method calls.
-
-