|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.struts.util.ConvertUtils
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.
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 |
|
Field Detail |
private static java.lang.Boolean defaultBoolean
private static java.lang.Byte defaultByte
private static java.lang.Character defaultCharacter
private static java.lang.Double defaultDouble
private static java.lang.Float defaultFloat
private static java.lang.Integer defaultInteger
private static java.lang.Long defaultLong
private static java.lang.Short defaultShort
private static java.lang.Class stringClass
Constructor Detail |
public ConvertUtils()
Method Detail |
public boolean getDefaultBoolean()
public void setDefaultBoolean(boolean defaultBoolean)
public byte getDefaultByte()
public void setDefaultByte(byte defaultByte)
public char getDefaultCharacter()
public void setDefaultCharacter(char defaultCharacter)
public double getDefaultDouble()
public void setDefaultDouble(double defaultDouble)
public float getDefaultFloat()
public void setDefaultFloat(float defaultFloat)
public int getDefaultInteger()
public void setDefaultInteger(int defaultInteger)
public long getDefaultLong()
public void setDefaultLong(long defaultLong)
public short getDefaultShort()
public void setDefaultShort(short defaultShort)
public static java.lang.String convert(java.lang.Object value)
value
- Value to be converted (may be null)public static java.lang.Object convert(java.lang.String value, java.lang.Class clazz)
type
as the name of a Java primitive
type, an instance of the corresponding wrapper class (initialized
to the correct value) is returned instead.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)public static java.lang.Object convert(java.lang.String[] values, java.lang.Class clazz)
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.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)private static java.lang.Boolean convertBoolean(java.lang.String value, java.lang.Boolean defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion errorprivate static java.lang.Byte convertByte(java.lang.String value, java.lang.Byte defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion errorprivate static java.lang.Character convertCharacter(java.lang.String value, java.lang.Character defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion errorprivate static java.lang.Double convertDouble(java.lang.String value, java.lang.Double defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion errorprivate static java.lang.Float convertFloat(java.lang.String value, java.lang.Float defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion errorprivate static java.lang.Integer convertInteger(java.lang.String value, java.lang.Integer defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion errorprivate static java.lang.Long convertLong(java.lang.String value, java.lang.Long defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion errorprivate static java.lang.Short convertShort(java.lang.String value, java.lang.Short defaultValue)
value
- The string value to convertdefaultValue
- Default value to return on a conversion error
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |