org.apache.commons.beanutils
Class ConvertUtils

java.lang.Object
  |
  +--org.apache.commons.beanutils.ConvertUtils

public class ConvertUtils
extends java.lang.Object

Utility methods for converting String scalar values to objects of the specified Class, String arrays to arrays of the specified Class.

For more details, see ConvertUtilsBean which provides the implementations for these methods.

Version:
$Revision: 1.17 $ $Date: 2004/02/28 13:18:33 $
Author:
Craig R. McClanahan, Ralph Schaer, Chris Audley
See Also:
ConvertUtilsBean

Constructor Summary
ConvertUtils()
           
 
Method Summary
static java.lang.String convert(java.lang.Object value)
          Convert the specified value into a String.
static java.lang.Object convert(java.lang.String[] values, java.lang.Class clazz)
          Convert an array of specified values to an array of objects of the specified class (if possible).
static java.lang.Object convert(java.lang.String value, java.lang.Class clazz)
          Convert the specified value to an object of the specified class (if possible).
static void deregister()
          Remove all registered Converters, and re-establish the standard Converters.
static void deregister(java.lang.Class clazz)
          Remove any registered Converter for the specified destination Class.
static boolean getDefaultBoolean()
          Deprecated. Register replacement converters for Boolean.TYPE and Boolean.class instead
static byte getDefaultByte()
          Deprecated. Register replacement converters for Byte.TYPE and Byte.class instead
static char getDefaultCharacter()
          Deprecated. Register replacement converters for Character.TYPE and Character.class instead
static double getDefaultDouble()
          Deprecated. Register replacement converters for Double.TYPE and Double.class instead
static float getDefaultFloat()
          Deprecated. Register replacement converters for Float.TYPE and Float.class instead
static int getDefaultInteger()
          Deprecated. Register replacement converters for Integer.TYPE and Integer.class instead
static long getDefaultLong()
          Deprecated. Register replacement converters for Long.TYPE and Long.class instead
static short getDefaultShort()
          Deprecated. Register replacement converters for Short.TYPE and Short.class instead
static Converter lookup(java.lang.Class clazz)
          Look up and return any registered Converter for the specified destination class; if there is no registered Converter, return null.
static void register(Converter converter, java.lang.Class clazz)
          Register a custom Converter for the specified destination Class, replacing any previously registered Converter.
static void setDefaultBoolean(boolean newDefaultBoolean)
          Deprecated. Register replacement converters for Boolean.TYPE and Boolean.class instead
static void setDefaultByte(byte newDefaultByte)
          Deprecated. Register replacement converters for Byte.TYPE and Byte.class instead
static void setDefaultCharacter(char newDefaultCharacter)
          Deprecated. Register replacement converters for Character.TYPE and Character.class instead
static void setDefaultDouble(double newDefaultDouble)
          Deprecated. Register replacement converters for Double.TYPE and Double.class instead
static void setDefaultFloat(float newDefaultFloat)
          Deprecated. Register replacement converters for Float.TYPE and Float.class instead
static void setDefaultInteger(int newDefaultInteger)
          Deprecated. Register replacement converters for Integer.TYPE and Integer.class instead
static void setDefaultLong(long newDefaultLong)
          Deprecated. Register replacement converters for Long.TYPE and Long.class instead
static void setDefaultShort(short newDefaultShort)
          Deprecated. Register replacement converters for Short.TYPE and Short.class instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertUtils

public ConvertUtils()
Method Detail

getDefaultBoolean

public static boolean getDefaultBoolean()
Deprecated. Register replacement converters for Boolean.TYPE and Boolean.class instead

Gets the default value for Boolean conversions.


setDefaultBoolean

public static void setDefaultBoolean(boolean newDefaultBoolean)
Deprecated. Register replacement converters for Boolean.TYPE and Boolean.class instead

Sets the default value for Boolean conversions.


getDefaultByte

public static byte getDefaultByte()
Deprecated. Register replacement converters for Byte.TYPE and Byte.class instead

Gets the default value for Byte conversions.


setDefaultByte

public static void setDefaultByte(byte newDefaultByte)
Deprecated. Register replacement converters for Byte.TYPE and Byte.class instead

Sets the default value for Byte conversions.


getDefaultCharacter

public static char getDefaultCharacter()
Deprecated. Register replacement converters for Character.TYPE and Character.class instead

Gets the default value for Character conversions.


setDefaultCharacter

public static void setDefaultCharacter(char newDefaultCharacter)
Deprecated. Register replacement converters for Character.TYPE and Character.class instead

Sets the default value for Character conversions.


getDefaultDouble

public static double getDefaultDouble()
Deprecated. Register replacement converters for Double.TYPE and Double.class instead

Gets the default value for Double conversions.


setDefaultDouble

public static void setDefaultDouble(double newDefaultDouble)
Deprecated. Register replacement converters for Double.TYPE and Double.class instead

Sets the default value for Double conversions.


getDefaultFloat

public static float getDefaultFloat()
Deprecated. Register replacement converters for Float.TYPE and Float.class instead

Get the default value for Float conversions.


setDefaultFloat

public static void setDefaultFloat(float newDefaultFloat)
Deprecated. Register replacement converters for Float.TYPE and Float.class instead

Sets the default value for Float conversions.


getDefaultInteger

public static int getDefaultInteger()
Deprecated. Register replacement converters for Integer.TYPE and Integer.class instead

Gets the default value for Integer conversions.


setDefaultInteger

public static void setDefaultInteger(int newDefaultInteger)
Deprecated. Register replacement converters for Integer.TYPE and Integer.class instead

Sets the default value for Integer conversions.


getDefaultLong

public static long getDefaultLong()
Deprecated. Register replacement converters for Long.TYPE and Long.class instead

Gets the default value for Long conversions.


setDefaultLong

public static void setDefaultLong(long newDefaultLong)
Deprecated. Register replacement converters for Long.TYPE and Long.class instead

Sets the default value for Long conversions.


getDefaultShort

public static short getDefaultShort()
Deprecated. Register replacement converters for Short.TYPE and Short.class instead

Gets the default value for Short conversions.


setDefaultShort

public static void setDefaultShort(short newDefaultShort)
Deprecated. Register replacement converters for Short.TYPE and Short.class instead

Sets the default value for Short conversions.


convert

public static java.lang.String convert(java.lang.Object value)

Convert the specified value into a String.

For more details see ConvertUtilsBean.

See Also:
ConvertUtilsBean.convert(Object)

convert

public static java.lang.Object convert(java.lang.String value,
                                       java.lang.Class clazz)

Convert the specified value to an object of the specified class (if possible). Otherwise, return a String representation of the value.

For more details see ConvertUtilsBean.

See Also:
ConvertUtilsBean.convert(String, Class)

convert

public static java.lang.Object convert(java.lang.String[] values,
                                       java.lang.Class clazz)

Convert an array of specified values to an array of objects of the specified class (if possible).

For more details see ConvertUtilsBean.

See Also:
ConvertUtilsBean.convert(String[], Class)

deregister

public static void deregister()

Remove all registered Converters, and re-establish the standard Converters.

For more details see ConvertUtilsBean.

See Also:
ConvertUtilsBean.deregister()

deregister

public static void deregister(java.lang.Class clazz)

Remove any registered Converter for the specified destination Class.

For more details see ConvertUtilsBean.

See Also:
ConvertUtilsBean.deregister(Class)

lookup

public static Converter lookup(java.lang.Class clazz)

Look up and return any registered Converter for the specified destination class; if there is no registered Converter, return null.

For more details see ConvertUtilsBean.

See Also:
ConvertUtilsBean.lookup(Class)

register

public static void register(Converter converter,
                            java.lang.Class clazz)

Register a custom Converter for the specified destination Class, replacing any previously registered Converter.

For more details see ConvertUtilsBean.

See Also:
ConvertUtilsBean.register(Converter, Class)


Copyright (c) 2001-2004 - Apache Software Foundation