|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bankframe.validation.DataTypeConvertor
This class provides utility methods for converting data-types.
for more information on rounding of numbers.
Field Summary | |
static int |
ROUND_CEILING
|
static int |
ROUND_DOWN
|
static int |
ROUND_FLOOR
|
static int |
ROUND_HALF_DOWN
|
static int |
ROUND_HALF_EVEN
|
static int |
ROUND_HALF_UP
|
static int |
ROUND_UNNECESSARY
|
static int |
ROUND_UP
|
Constructor Summary | |
DataTypeConvertor()
|
Method Summary | |
static java.lang.Boolean |
getBoolean(java.lang.String value)
This method converts a String value to a Boolean value |
static java.lang.Double |
getDouble(java.lang.String value)
This method converts a String value to a Double value |
static java.lang.Float |
getFloat(java.lang.String value)
This method converts a String value to a Float value |
static java.lang.Integer |
getInteger(java.lang.String value)
This method converts a String value to an Integer value |
static java.lang.String |
getString(java.lang.Object value)
This method converts an Object value to a String value |
static java.lang.String |
padString(java.lang.String value,
char padChar,
int length,
boolean padRight)
This method returns a String padded with the specified amount of padding characters, to the left or to the right |
static java.lang.Integer |
parseInteger(java.lang.String value)
This method converts a String value to an Integer value. |
static java.lang.Double |
round(java.lang.Double value,
int decimalPlaces)
This method rounds up the specified value to the specified number of decimal places |
static java.lang.Double |
round(java.lang.Double value,
int decimalPlaces,
int roundMethod)
This method rounds the specified value to the specified number of decimal places using the specified rounding method |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ROUND_CEILING
public static final int ROUND_DOWN
public static final int ROUND_FLOOR
public static final int ROUND_HALF_DOWN
public static final int ROUND_HALF_EVEN
public static final int ROUND_HALF_UP
public static final int ROUND_UNNECESSARY
public static final int ROUND_UP
Constructor Detail |
public DataTypeConvertor()
Method Detail |
public static java.lang.Boolean getBoolean(java.lang.String value) throws ValidationException
value
- String value to be converted
true if String equals yes, y, true, t or 1
false if String equals no, n, false, f or 0
ValidationException
- if the string cannot be converted to a Boolean valuepublic static java.lang.Integer getInteger(java.lang.String value) throws ValidationException
ValidationException
- if the String cannot be converted to an Integer valuepublic static java.lang.Integer parseInteger(java.lang.String value) throws ValidationException
value
-
ValidationException
public static java.lang.Float getFloat(java.lang.String value) throws ValidationException
ValidationException
- if the String cannot be converted to a Float valuepublic static java.lang.Double getDouble(java.lang.String value) throws ValidationException
ValidationException
- if the String cannot be converted to a Double valuepublic static java.lang.String getString(java.lang.Object value) throws ValidationException
ValidationException
- if the Object cannot be converted to a String valuepublic static java.lang.Double round(java.lang.Double value, int decimalPlaces)
value
- The value to round updecimalPlaces
- The number of decimal places to round to
public static java.lang.Double round(java.lang.Double value, int decimalPlaces, int roundMethod)
value
- The value to rounddecimalPlaces
- The number of decimal places to round toroundMethod
- The rounding method to use
public static java.lang.String padString(java.lang.String value, char padChar, int length, boolean padRight) throws ValidationException
value
- String to padpadChar
- The character to use for paddinglength
- The length of the padded StringpadRight
- If true the padding will be added to the right, otherwise
the padding will be added to the left
ValidationException
- if the value is null or too long to be padded
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |