|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Utility
Provides utility methods used throughout the application.
Field Summary | |
---|---|
static int |
MAX_ALLOW_EXPRESSIONS_IN_QUERY
Maximum allow expressions in a hql query. |
Method Summary | |
---|---|
java.lang.String |
array2string(java.lang.Object[] array,
java.lang.String separator)
Convert an array of objects to a string. |
java.lang.String |
bigDecimal2String(java.math.BigDecimal bigDecimalValue)
Convert a BigDecimal object to a String object. |
java.lang.String |
boolean2String(boolean booleanValue)
Convert a boolean value to a String object. |
boolean |
checkLongTextMaxLength(java.lang.String value)
Returns true if the length of the given value <= long text max length. |
boolean |
checkShortTextMaxLength(java.lang.String value)
Returns true if the length of the given value <= short text max length. |
java.util.List |
composeQueries(java.lang.String queryTemplate,
java.lang.String placeHolder,
java.util.Collection values)
Compose queries based on the given query template, place holder and values. |
java.lang.String |
date2String(java.util.Date date)
Convert a Date to a String based on the system default date format. |
java.lang.String |
date2String(java.util.Date date,
java.text.SimpleDateFormat sdf)
Convert a date to a string based on the given date format. |
java.lang.String |
escapeName2UrlFriendly(java.lang.String name)
Returns an escaped name which is URL-friendly. |
java.lang.String |
exception2string(java.lang.Exception exception)
Returns a string with the full stack of the given exception. |
java.util.Map |
getCardTypeMap()
Get a map of the supported card types for display in Spring. |
java.lang.String |
getLocalizedFile(java.lang.String baseDir,
java.lang.String filePath,
java.lang.String fileExtension,
java.util.Locale locale)
Return the localized file path of the given file path. |
java.util.Map |
getMonthMap()
Get a map of the numbers of months of the year for the Spring form input for credit card expiry. |
java.lang.String |
getRandomStringWithLength(int length)
Get a random string with the required length. |
java.lang.String |
getTimeStamp()
Returns a timestamp string. |
java.util.Map |
getYearMap()
Get a map of years for the Spring form input for credit card expiry. |
java.lang.String |
int2String(int intValue)
Convert an int value to a String object. |
boolean |
isAlphaNumeric(java.lang.String string)
Returns true if the given string is all alphanumeric characters. |
boolean |
isValidGuidStr(java.lang.String string)
Returns true if the given string is a valid guid string. |
boolean |
isValidZipPostalCode(java.lang.String zipPostalCode)
Returns true if the given zip postal code is valid. |
java.lang.String |
regexQuote(java.lang.String regexString)
Escapes the provided String as a literal String safe for use as a regular expression. |
java.math.BigDecimal |
string2BigDecimal(java.lang.String stringValue)
Convert a String to a BigDecimal object. |
boolean |
string2Boolean(java.lang.String stringValue)
Convert a String to a boolean value. |
java.util.Currency |
string2Currency(java.lang.String stringValue)
Convert a String to a Currency instance. |
java.util.Date |
string2Date(java.lang.String stringValue)
Convert a String to a Date based on the system default date format. |
java.util.Date |
string2Date(java.lang.String dateString,
java.text.SimpleDateFormat sdf)
Convert a date string and return a Date object. |
int |
string2Int(java.lang.String stringValue)
Convert a String to an int value. |
java.util.Locale |
string2Locale(java.lang.String stringValue)
Convert a String to a Locale instance. |
long |
string2Long(java.lang.String stringValue)
Convert a String to an long value. |
Money |
string2Money(java.util.Currency currency,
java.lang.String value)
Convert a String to a Money instance. |
Field Detail |
---|
static final int MAX_ALLOW_EXPRESSIONS_IN_QUERY
Note: since Oracle only allow 1000 expressions in one query, this value should be set less than 1000.
Method Detail |
---|
java.lang.String array2string(java.lang.Object[] array, java.lang.String separator)
array
- the array of objectsseparator
- the separator
java.lang.String bigDecimal2String(java.math.BigDecimal bigDecimalValue)
BigDecimal
object to a String
object.
bigDecimalValue
- the BigDecimal
object
String
objectjava.lang.String boolean2String(boolean booleanValue)
boolean
value to a String
object.
booleanValue
- the boolean
value
String
objectboolean checkLongTextMaxLength(java.lang.String value)
true
if the length of the given value <= long text max length. Otherwise, false
.
value
- the value to check
true
if the length of the given value <= long text max length. Otherwise, false
.boolean checkShortTextMaxLength(java.lang.String value)
true
if the length of the given value <= short text max length. Otherwise, false
.
value
- the value to check
true
if the length of the given value <= short text max length. Otherwise, false
.java.util.List composeQueries(java.lang.String queryTemplate, java.lang.String placeHolder, java.util.Collection values)
Note: since Oracle only allow 1000 expressions in one query, we have to separate big query over 1000 expressions to multiple queries. This method can be used to create multiple queries for you.
queryTemplate
- the query templateplaceHolder
- the place holder as a regular expressionvalues
- the values to replace the place holder.
java.lang.String date2String(java.util.Date date)
Date
to a String
based on the system default date format.
date
- the date
java.lang.String date2String(java.util.Date date, java.text.SimpleDateFormat sdf)
date
- the datesdf
- the simple date format
java.lang.String escapeName2UrlFriendly(java.lang.String name)
name
- the original name
java.lang.String exception2string(java.lang.Exception exception)
exception
- the exception
java.util.Map getCardTypeMap()
java.lang.String getLocalizedFile(java.lang.String baseDir, java.lang.String filePath, java.lang.String fileExtension, java.util.Locale locale)
baseDir
- the base directoryfilePath
- the file path relative to the base directoryfileExtension
- the file extensionlocale
- the locale
java.util.Map getMonthMap()
java.lang.String getRandomStringWithLength(int length)
length
- the length of the string to return
java.lang.String getTimeStamp()
java.util.Map getYearMap()
java.lang.String int2String(int intValue)
int
value to a String
object.
intValue
- the int
value
String
objectboolean isAlphaNumeric(java.lang.String string)
true
if the given string is all alphanumeric characters. Otherwise, false
string
- the string
true
if the given string is all alphanumeric characters. Otherwise, false
boolean isValidGuidStr(java.lang.String string)
true
if the given string is a valid guid string. Otherwise, false
string
- the string
true
if the given string is a valid guid string. Otherwise, false
boolean isValidZipPostalCode(java.lang.String zipPostalCode)
true
if the given zip postal code is valid. Otherwise, false
.
zipPostalCode
- the zip postal code.
true
if the given zip postal code is valid. Otherwise, false
.java.lang.String regexQuote(java.lang.String regexString)
regexString
- The string to be escaped
java.math.BigDecimal string2BigDecimal(java.lang.String stringValue) throws EpBigDecimalBindException
String
to a BigDecimal
object.
stringValue
- the string
BigDecimal
object
EpBigDecimalBindException
- if the given string cannot be converted to a BigDecimal
objectboolean string2Boolean(java.lang.String stringValue) throws EpBooleanBindException
String
to a boolean
value.
stringValue
- the string
boolean
value
EpBooleanBindException
- if the given string cannot be converted to a boolean
valuejava.util.Currency string2Currency(java.lang.String stringValue) throws EpCurrencyBindException
String
to a Currency
instance.
stringValue
- the string
Currency
instance.
EpCurrencyBindException
- if the given string cannot be converted to a Currency
instancejava.util.Date string2Date(java.lang.String stringValue) throws EpDateBindException
String
to a Date
based on the system default date format.
stringValue
- the string
Date
object
EpDateBindException
- if the given string cannot be converted to a Date
objectjava.util.Date string2Date(java.lang.String dateString, java.text.SimpleDateFormat sdf) throws EpDateBindException
Date
object.
dateString
- A date string to parsesdf
- The simple date format of the date string
Date
object if the data string is valid. EpDateBindException
- if the given string cannot be converted to a Date
objectint string2Int(java.lang.String stringValue) throws EpIntBindException
String
to an int
value.
stringValue
- the string
int
value
EpIntBindException
- if the given string cannot be converted to an int
valuejava.util.Locale string2Locale(java.lang.String stringValue) throws EpLocaleBindException
String
to a Locale
instance.
stringValue
- the string
Locale
instance.
EpLocaleBindException
- if the given string cannot be converted to a Locale
instancelong string2Long(java.lang.String stringValue) throws EpLongBindException
String
to an long
value.
stringValue
- the string
long
value
EpLongBindException
- if the given string cannot be converted to an long
valueMoney string2Money(java.util.Currency currency, java.lang.String value)
String
to a Money
instance.
currency
- the currencyvalue
- the value
Money
instance
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |