spring-framework / org.springframework.beans.propertyeditors / CustomNumberEditor / <init>

<init>

CustomNumberEditor(numberClass: Class<out Number>, allowEmpty: Boolean)

Create a new CustomNumberEditor instance, using the default valueOf methods for parsing and toString methods for rendering.

The "allowEmpty" parameter states if an empty String should be allowed for parsing, i.e. get interpreted as null value. Else, an IllegalArgumentException gets thrown in that case.

Parameters

numberClass - Number subclass to generate

allowEmpty - if empty strings should be allowed

Exceptions

IllegalArgumentException - if an invalid numberClass has been specified

See Also
org.springframework.util.NumberUtils#parseNumber(String, Class)Integer#valueOfInteger#toString

CustomNumberEditor(numberClass: Class<out Number>, @Nullable numberFormat: NumberFormat, allowEmpty: Boolean)

Create a new CustomNumberEditor instance, using the given NumberFormat for parsing and rendering.

The allowEmpty parameter states if an empty String should be allowed for parsing, i.e. get interpreted as null value. Else, an IllegalArgumentException gets thrown in that case.

Parameters

numberClass - Number subclass to generate

numberFormat - NumberFormat to use for parsing and rendering

allowEmpty - if empty strings should be allowed

Exceptions

IllegalArgumentException - if an invalid numberClass has been specified

See Also
org.springframework.util.NumberUtils#parseNumber(String, Class, java.text.NumberFormat)java.text.NumberFormat#parsejava.text.NumberFormat#format