Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util
Class NumberUtil

java.lang.Object
  extended by org.hyperic.util.NumberUtil

public final class NumberUtil
extends java.lang.Object

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 java.lang.Number NaN
          Constant value representing "not a number".
 
Method Summary
static java.lang.String numberAsString(double input)
          Format the input number as a string (using the default locale).
static java.lang.String percentageAsString(double input)
          Format the input percentage as a string (using the default locale).
static java.lang.Number stringAsNumber(java.lang.String input)
          Parse the input string (using the default locale) and return its numeric representation.
static java.lang.Number stringAsPercentage(java.lang.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

NaN

public static final java.lang.Number NaN
Constant value representing "not a number".

Method Detail

stringAsNumber

public static java.lang.Number stringAsNumber(java.lang.String input)
Parse the input string (using the default locale) and return its numeric representation. If the input string is null, empty or cannot be parsed, return NaN.


numberAsString

public static java.lang.String numberAsString(double input)
Format the input number as a string (using the default locale). If the input number is NaN, return null.


stringAsPercentage

public static java.lang.Number stringAsPercentage(java.lang.String input)
Parse the input string (using the default locale) and return its numeric percentage representation. If the input string is null, empty or cannot be parsed, return NaN.


percentageAsString

public static java.lang.String percentageAsString(double input)
Format the input percentage as a string (using the default locale). If the input percentage is NaN, return null.


Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.