public class Converter extends Object
Constructor and Description |
---|
Converter() |
Modifier and Type | Method and Description |
---|---|
static Object |
convert(Object value,
Class<?> toType)
Convert the given value object to an object of the given type
|
static String |
formatCalendar(Calendar date,
String pattern) |
static String |
formatDate(Calendar date,
String pattern) |
static String |
formatDate(Date date,
String pattern) |
static String |
formatDate(Date date,
String pattern) |
static String |
formatDate(String date,
String pattern) |
static boolean |
getBoolean(Object o) |
static boolean |
getBoolean(Object o,
boolean defaultValue) |
static Calendar |
getCalendar(Object o) |
static Calendar |
getCalendar(Object date,
Calendar defaultValue)
Converts the given object to a calendar object.
|
static char |
getChar(Object o) |
static char |
getChar(Object o,
char defaultValue) |
static Date |
getDate(Object date) |
static Date |
getDate(Object date,
Date defaultValue) |
static double |
getDouble(Object o) |
static double |
getDouble(Object o,
double defaultValue) |
static File |
getFile(Object o) |
static float |
getFloat(Object o) |
static float |
getFloat(Object o,
float defaultValue) |
static int |
getInt(Object o)
Converts object to an integer, defaults to 0 if object is not convertible
or is null.
|
static int |
getInt(Object o,
int defaultValue)
Convert object to integer, return defaultValue if object is not
convertible or is null.
|
static long |
getLong(Object o)
Converts object to a long, defaults to 0 if object is not convertible or
is null
|
static long |
getLong(Object o,
long defaultValue)
Converts object to a long, return defaultValue if object is not
convertible or is null.
|
static String |
getString(Object o)
Converts object to a String, defaults to empty string if object is null.
|
static String |
getString(Object o,
String defaultValue)
Converts object to a String, return defaultValue if object is null.
|
static String |
insertLineBreaks(String v,
String insertion) |
public static Object convert(Object value, Class<?> toType)
value
- toType
- public static Calendar getCalendar(Object date, Calendar defaultValue)
date
- public static float getFloat(Object o, float defaultValue)
public static float getFloat(Object o)
public static double getDouble(Object o, double defaultValue)
public static double getDouble(Object o)
public static boolean getBoolean(Object o)
public static boolean getBoolean(Object o, boolean defaultValue)
public static int getInt(Object o, int defaultValue)
o
- defaultValue
- public static char getChar(Object o)
public static char getChar(Object o, char defaultValue)
public static int getInt(Object o)
o
- public static long getLong(Object o, long defaultValue)
o
- defaultValue
- public static long getLong(Object o)
o
- public static String getString(Object o, String defaultValue)
o
- defaultValue
- public static String getString(Object o)
o
- Copyright © 1998-2013 Apache Software Foundation. All Rights Reserved.