Apache Struts API Documentation: Class ConvertUtils

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.util
Class ConvertUtils

    java.lang.Object
      |
      +--org.apache.struts.util.ConvertUtils

Deprecated. At some point after Struts 1.0 final, will be replaced by an equivalent class in the Jakarta Commons Beanutils package.

public class ConvertUtils
extends java.lang.Object

Utility methods for converting String values to objects of the specified class. If you specify a Java primitive type, or an array of a Java primitive type, as a destination type, a scalar or array of the coresponding Java wrapper class will be created instead. If you attempt to convert an Object or Object array of a non-String and non-primitive type, it will be converted to a scalar String or array of Strings, as appropriate.

Version:
  $Revision: 1.1 $ $Date: 2001-09-17 21:13:30 +0100 (Mon, 17 Sep 2001) $
Author:
  Craig R. McClanahan, Ralph Schaer, Chris Audley

Field Summary
`private static java.lang.Boolean` | `defaultBoolean` Deprecated. The default value for Boolean conversions.
`private static java.lang.Byte` | `defaultByte` Deprecated. The default value for Byte conversions.
`private static java.lang.Character` | `defaultCharacter` Deprecated. The default value for Character conversions.
`private static java.lang.Double` | `defaultDouble` Deprecated. The default value for Double conversions.
`private static java.lang.Float` | `defaultFloat` Deprecated. The default value for Float conversions.
`private static java.lang.Integer` | `defaultInteger` Deprecated. The default value for Integer conversions.
`private static java.lang.Long` | `defaultLong` Deprecated. The default value for Long conversions.
`private static java.lang.Short` | `defaultShort` Deprecated. The default value for Short conversions.
`private static java.lang.Class` | `stringClass` Deprecated. The Class object for java.lang.String.

Constructor Summary
`ConvertUtils()` Deprecated.

Method Summary
`static java.lang.String` | `convert(java.lang.Object value)` Deprecated. Convert the specified value into a String.
`static java.lang.Object` | `convert(java.lang.String[] values, java.lang.Class clazz)` Deprecated. 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)` Deprecated. Convert the specified value to an object of the specified class (if possible).
`private static java.lang.Boolean` | `convertBoolean(java.lang.String value, java.lang.Boolean defaultValue)` Deprecated. Convert a String value to a corresponding Boolean value.
`private static java.lang.Byte` | `convertByte(java.lang.String value, java.lang.Byte defaultValue)` Deprecated. Convert a String value to a corresponding Byte value.
`private static java.lang.Character` | `convertCharacter(java.lang.String value, java.lang.Character defaultValue)` Deprecated. Convert a String value to a corresponding Character value.
`private static java.lang.Double` | `convertDouble(java.lang.String value, java.lang.Double defaultValue)` Deprecated. Convert a String value to a corresponding Double value.
`private static java.lang.Float` | `convertFloat(java.lang.String value, java.lang.Float defaultValue)` Deprecated. Convert a String value to a corresponding Float value.
`private static java.lang.Integer` | `convertInteger(java.lang.String value, java.lang.Integer defaultValue)` Deprecated. Convert a String value to a corresponding Integer value.
`private static java.lang.Long` | `convertLong(java.lang.String value, java.lang.Long defaultValue)` Deprecated. Convert a String value to a corresponding Long value.
`private static java.lang.Short` | `convertShort(java.lang.String value, java.lang.Short defaultValue)` Deprecated. Convert a String value to a corresponding Short value.
`boolean` | `getDefaultBoolean()` Deprecated.
`byte` | `getDefaultByte()` Deprecated.
`char` | `getDefaultCharacter()` Deprecated.
`double` | `getDefaultDouble()` Deprecated.
`float` | `getDefaultFloat()` Deprecated.
`int` | `getDefaultInteger()` Deprecated.
`long` | `getDefaultLong()` Deprecated.
`short` | `getDefaultShort()` Deprecated.
`void` | `setDefaultBoolean(boolean defaultBoolean)` Deprecated.
`void` | `setDefaultByte(byte defaultByte)` Deprecated.
`void` | `setDefaultCharacter(char defaultCharacter)` Deprecated.
`void` | `setDefaultDouble(double defaultDouble)` Deprecated.
`void` | `setDefaultFloat(float defaultFloat)` Deprecated.
`void` | `setDefaultInteger(int defaultInteger)` Deprecated.
`void` | `setDefaultLong(long defaultLong)` Deprecated.
`void` | `setDefaultShort(short defaultShort)` Deprecated.

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### defaultBoolean

    private static java.lang.Boolean defaultBoolean

  Deprecated.
  The default value for Boolean conversions.

### defaultByte

    private static java.lang.Byte defaultByte

  Deprecated.
  The default value for Byte conversions.

### defaultCharacter

    private static java.lang.Character defaultCharacter

  Deprecated.
  The default value for Character conversions.

### defaultDouble

    private static java.lang.Double defaultDouble

  Deprecated.
  The default value for Double conversions.

### defaultFloat

    private static java.lang.Float defaultFloat

  Deprecated.
  The default value for Float conversions.

### defaultInteger

    private static java.lang.Integer defaultInteger

  Deprecated.
  The default value for Integer conversions.

### defaultLong

    private static java.lang.Long defaultLong

  Deprecated.
  The default value for Long conversions.

### defaultShort

    private static java.lang.Short defaultShort

  Deprecated.
  The default value for Short conversions.

### stringClass

    private static java.lang.Class stringClass

  Deprecated.
  The Class object for java.lang.String.

Constructor Detail

### ConvertUtils

    public ConvertUtils()

  Deprecated.

Method Detail

### getDefaultBoolean

    public boolean getDefaultBoolean()

  Deprecated.

### setDefaultBoolean

    public void setDefaultBoolean(boolean defaultBoolean)

  Deprecated.

### getDefaultByte

    public byte getDefaultByte()

  Deprecated.

### setDefaultByte

    public void setDefaultByte(byte defaultByte)

  Deprecated.

### getDefaultCharacter

    public char getDefaultCharacter()

  Deprecated.

### setDefaultCharacter

    public void setDefaultCharacter(char defaultCharacter)

  Deprecated.

### getDefaultDouble

    public double getDefaultDouble()

  Deprecated.

### setDefaultDouble

    public void setDefaultDouble(double defaultDouble)

  Deprecated.

### getDefaultFloat

    public float getDefaultFloat()

  Deprecated.

### setDefaultFloat

    public void setDefaultFloat(float defaultFloat)

  Deprecated.

### getDefaultInteger

    public int getDefaultInteger()

  Deprecated.

### setDefaultInteger

    public void setDefaultInteger(int defaultInteger)

  Deprecated.

### getDefaultLong

    public long getDefaultLong()

  Deprecated.

### setDefaultLong

    public void setDefaultLong(long defaultLong)

  Deprecated.

### getDefaultShort

    public short getDefaultShort()

  Deprecated.

### setDefaultShort

    public void setDefaultShort(short defaultShort)

  Deprecated.

### convert

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

  Deprecated.
  Convert the specified value into a String. If the specified value is an array, the first element (converted to a String) will be returned.
  Parameters:
    `value` - Value to be converted (may be null)

### convert

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

  Deprecated.
  Convert the specified value to an object of the specified class (if possible). Otherwise, return a String representation of the value. If you specify `type` as the name of a Java primitive type, an instance of the corresponding wrapper class (initialized to the correct value) is returned instead.
  Parameters:
    `value` - Value to be converted (may be null)
    `clazz` - Java class to be converted to (must be java.lang.String or one of the primitive type wrappers)

### convert

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

  Deprecated.
  Convert an array of specified values to an array of objects of the specified class (if possible). If you specify `type` as one of the Java primitive types, an array of that type will be returned; otherwise an array of the requested type (must be String or a Java wrapper class for the primitive types) will be returned.
  Parameters:
    `value` - Value to be converted (may be null)
    `clazz` - Java array class to be converted to (must be String[], or an array of one of the Java primitive types)

### convertBoolean

    private static java.lang.Boolean convertBoolean(java.lang.String value,
                                                    java.lang.Boolean defaultValue)

  Deprecated.
  Convert a String value to a corresponding Boolean value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

### convertByte

    private static java.lang.Byte convertByte(java.lang.String value,
                                              java.lang.Byte defaultValue)

  Deprecated.
  Convert a String value to a corresponding Byte value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

### convertCharacter

    private static java.lang.Character convertCharacter(java.lang.String value,
                                                        java.lang.Character defaultValue)

  Deprecated.
  Convert a String value to a corresponding Character value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

### convertDouble

    private static java.lang.Double convertDouble(java.lang.String value,
                                                  java.lang.Double defaultValue)

  Deprecated.
  Convert a String value to a corresponding Double value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

### convertFloat

    private static java.lang.Float convertFloat(java.lang.String value,
                                                java.lang.Float defaultValue)

  Deprecated.
  Convert a String value to a corresponding Float value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

### convertInteger

    private static java.lang.Integer convertInteger(java.lang.String value,
                                                    java.lang.Integer defaultValue)

  Deprecated.
  Convert a String value to a corresponding Integer value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

### convertLong

    private static java.lang.Long convertLong(java.lang.String value,
                                              java.lang.Long defaultValue)

  Deprecated.
  Convert a String value to a corresponding Long value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

### convertShort

    private static java.lang.Short convertShort(java.lang.String value,
                                                java.lang.Short defaultValue)

  Deprecated.
  Convert a String value to a corresponding Short value.
  Parameters:
    `value` - The string value to convert
    `defaultValue` - Default value to return on a conversion error

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2001 - Apache Software Foundation