Copyright 2002 by aragost

com.aragost.util
Class Convert

java.lang.Object
  |
  +--com.aragost.util.Convert

public abstract class Convert
extends java.lang.Object

A utility class used to convert Objects to Strings, and Strings to Objects.


Constructor Summary
Convert()
           
 
Method Summary
static java.lang.Object convert(java.lang.String value, java.lang.Class type)
          Convert a String to an Object of the specified class.
static java.lang.String toString(java.lang.Object obj)
          Convert an object to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Convert

public Convert()
Method Detail

toString

public static java.lang.String toString(java.lang.Object obj)
Convert an object to a String. The PropertyEditor is used to do the conversion, if no PropertyEditor is found the conversion is done with the toString() method.

Parameters:
obj - The Object to convert
Returns:
The String representation of the specified Object

convert

public static java.lang.Object convert(java.lang.String value,
                                       java.lang.Class type)
Convert a String to an Object of the specified class. The conversion is done with the PropertyEditor of the specified class. If no PropertyEditor is found, an IllegalArgumentException is thrown. If the PropertyEditor is not able to convert the String a ConversionException is thrown. If the specified type is a wrapper class for a primitive type, the PropertyEditor for the primitive type is used. If the specified String is null, the null is retuned.

Parameters:
value - The String to convert
type - The Class to convert the specified String to
Returns:
The value of the conversion

Copyright 2002 by aragost