|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.core.util.NumberUtil
public final class NumberUtil
Utilities for dealing with number parsing / formatting. This class is mainly meant to be used by java beans and other classes that must do number formatting but cannot throw any exceptions during the process.
| Field Summary | |
|---|---|
static Number |
NaN
Constant value representing "not a number". |
| Method Summary | |
|---|---|
static String |
autoIncrementVersion(String oldVersion)
Given an old version string, this attempts to auto-generate a new incremented version. |
static String |
numberAsString(double input)
Format the input number as a string (using the default locale). |
static String |
percentageAsString(double input)
Format the input percentage as a string (using the default locale). |
static Number |
stringAsNumber(String input)
Parse the input string (using the default locale) and return its numeric representation. |
static Number |
stringAsPercentage(String input)
Parse the input string (using the default locale) and return its numeric percentage representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Number NaN
| Method Detail |
|---|
public static Number stringAsNumber(String input)
input string (using the default locale) and return its numeric representation. If the
input string is null, empty or cannot be parsed, return Double.NaN .
public static String numberAsString(double input)
input number as a string (using the default locale). If the input number is
Double.NaN, return null.
public static Number stringAsPercentage(String input)
input string (using the default locale) and return its numeric percentage representation.
If the input string is null, empty or cannot be parsed, return Double.NaN .
public static String percentageAsString(double input)
input percentage as a string (using the default locale). If the input
percentage is Double.NaN, return null.
public static String autoIncrementVersion(String oldVersion)
oldVersion - the version to increment
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||