Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.units
Class ApproxDurationFormatter

java.lang.Object
  extended by org.hyperic.util.units.DurationFormatter
      extended by org.hyperic.util.units.ApproxDurationFormatter
All Implemented Interfaces:
Formatter

public class ApproxDurationFormatter
extends DurationFormatter
implements Formatter

Format a value into an approximate duration.


Field Summary
 
Fields inherited from class org.hyperic.util.units.DurationFormatter
GRANULAR_DAYS, GRANULAR_HOURS, GRANULAR_MILLIS, GRANULAR_MINS, GRANULAR_SECS, GRANULAR_YEARS, MILLISEC_DIGITS
 
Constructor Summary
ApproxDurationFormatter()
           
 
Method Summary
protected  FormattedNumber format(java.math.BigDecimal baseTime, int granularity, int milliDigits, java.util.Locale locale)
           
 UnitNumber parse(java.lang.String val, java.util.Locale locale, ParseSpecifics specifics)
          Parse a string into a UnitNumber.
 
Methods inherited from class org.hyperic.util.units.DurationFormatter
breakDownTime, format, formatSame, getBaseValue, getScaledValue, parseTimeStr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hyperic.util.units.Formatter
format, formatSame, getBaseValue, getScaledValue
 

Constructor Detail

ApproxDurationFormatter

public ApproxDurationFormatter()
Method Detail

format

protected FormattedNumber format(java.math.BigDecimal baseTime,
                                 int granularity,
                                 int milliDigits,
                                 java.util.Locale locale)
Overrides:
format in class DurationFormatter

parse

public UnitNumber parse(java.lang.String val,
                        java.util.Locale locale,
                        ParseSpecifics specifics)
                 throws java.text.ParseException
Description copied from interface: Formatter
Parse a string into a UnitNumber. E.x. parse("34 MB") -> UnitNumber(34, UNIT_BYTES, SCALE_MEGA)

Specified by:
parse in interface Formatter
Overrides:
parse in class DurationFormatter
Parameters:
val - Value to parse
locale - Locale to parse with
specifics - An optional argument which gives the parser more information about parsing
Returns:
the number representing the parsed value
Throws:
java.text.ParseException

Hyperic HQ Plugin API v. 4.4.0.2

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