public abstract class NumberUtil extends Object
Constructor and Description |
---|
NumberUtil() |
Modifier and Type | Method and Description |
---|---|
static Number |
convertNumberToTargetClass(Number number,
Class targetClass)
Deprecated.
|
static Number |
parseNumber(String text,
Class targetClass)
Parse the given text into a number instance of the given target class,
using the corresponding default
decode methods. |
public static Number convertNumberToTargetClass(Number number, Class targetClass) throws IllegalArgumentException
ObjectUtil.convert(Object, Class)
IllegalArgumentException
public static Number parseNumber(String text, Class targetClass)
decode
methods. Trims the
input String
before attempting to parse the number. Supports
numbers in hex format (with leading 0x) and in octal format (with leading 0).text
- the text to converttargetClass
- the target class to parse intoIllegalArgumentException
- if the target class is not supported
(i.e. not a standard Number subclass as included in the JDK)Byte.decode(java.lang.String)
,
Short.decode(java.lang.String)
,
Integer.decode(java.lang.String)
,
Long.decode(java.lang.String)
,
Float.valueOf(java.lang.String)
,
Double.valueOf(java.lang.String)
,
BigDecimal(String)
Copyright © 2023 Liquibase.org. All rights reserved.