dsto.dfc.text
Class NumberTranslator

java.lang.Object
  extended by dsto.dfc.text.NumberTranslator
All Implemented Interfaces:
IStringTranslator

public class NumberTranslator
extends Object
implements IStringTranslator

Translates numbers to/from strings.

Version:
$Revision$
Author:
mpp

Nested Class Summary
 
Nested classes/interfaces inherited from interface dsto.dfc.text.IStringTranslator
IStringTranslator.FromString, IStringTranslator.ToString
 
Field Summary
static NumberTranslator BYTE
           
static NumberTranslator DOUBLE
           
static NumberTranslator FLOAT
           
static NumberTranslator INTEGER
           
static NumberTranslator LONG
           
static NumberTranslator SHORT
           
 
Constructor Summary
NumberTranslator(Class numberClass)
           
 
Method Summary
 Object fromString(String object)
          Convert/parse a string into the object type supported by this converter.
 String toString(Object o)
          Convert a value to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE

public static final NumberTranslator BYTE

INTEGER

public static final NumberTranslator INTEGER

SHORT

public static final NumberTranslator SHORT

LONG

public static final NumberTranslator LONG

FLOAT

public static final NumberTranslator FLOAT

DOUBLE

public static final NumberTranslator DOUBLE
Constructor Detail

NumberTranslator

public NumberTranslator(Class numberClass)
Method Detail

fromString

public Object fromString(String object)
                  throws InvalidFormatException
Description copied from interface: IStringTranslator
Convert/parse a string into the object type supported by this converter.

Specified by:
fromString in interface IStringTranslator
Parameters:
object - The string to convert.
Returns:
The converted object.
Throws:
InvalidFormatException - if the string is not in a format parsable by the converter.

toString

public String toString(Object o)
                throws IllegalArgumentException
Description copied from interface: IStringTranslator
Convert a value to a string.

Specified by:
toString in interface IStringTranslator
Parameters:
o - The value to convert. Null is not guaranteed to be valid.
Returns:
The string equivalent.
Throws:
IllegalArgumentException - if value is an object type understood by the converter.


Copyright © 2008 Commonwealth of Australia