public class MXFormat
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ALN |
static char |
AMCHAR |
static int |
AMOUNT |
static int |
BIGINT |
static int |
BLOB |
static int |
CLOB |
static int |
CRYPTO |
static int |
CRYPTOX |
static int |
DATE |
static java.lang.String |
DATESEP |
static int |
DATETIME |
static char |
DAYCHAR |
static int |
DECIMAL |
static int |
DURATION |
static int |
FLOAT |
static char |
GENTIMEZONECHAR |
static int |
GL |
static char[] |
HEXDIGITS
A table of hex digits
|
static char |
HOUR12CHAR |
static char |
HOUR24CHAR |
static int |
INTEGER |
static char |
ISOTIMEZONECHAR |
static int |
LONGALN |
static int |
LOWER |
static char |
MINCHAR |
static double |
MINSPERHOUR |
static char |
MONTHCHAR |
static char |
RFCTIMEZONECHAR |
static char |
SECONDCHAR |
static java.lang.String |
SEPERATORS |
static java.lang.String |
SEPERATORS_FR |
static int |
SMALLINT |
static java.lang.String |
SPECIALSAVECHARS
A string consisting of characters that should be preceded by a slash
|
static int |
TIME |
static java.lang.String |
TIMESEP |
static java.lang.String[] |
TYPEASSTRING |
static int |
UDTYPE |
static int |
UNLIMITEDPLACES |
static int |
UPPER |
static char |
YEARCHAR |
static int |
YORN |
Constructor and Description |
---|
MXFormat() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
amountToString(double d)
Convert a double to an amount string using the default locale.
|
static java.lang.String |
amountToString(double d,
int places)
Convert a double to an amount string using the default locale.
|
static java.lang.String |
amountToString(double d,
int places,
java.util.Locale l)
Convert a double to an amount string using the specified locale.
|
static byte[] |
blobToBytes(java.sql.Blob b)
Convert a Blob to a byte array.
|
static double |
booleanToDouble(boolean b)
Converts a boolean value to a double value.
|
static int |
booleanToInt(boolean b)
Converts a boolean value to an int value.
|
static long |
booleanToLong(boolean b)
Converts a boolean value to a long value.
|
static java.lang.String |
booleanToString(boolean b)
Converts a boolean value to a string value.
|
static java.lang.String |
booleanToString(boolean b,
java.util.Locale l)
Converts a boolean value to a string value.
|
static java.lang.String |
clobToString(java.sql.Clob c)
Convert a Clob to a string.
|
static java.lang.String |
convertToStoreYNValue(java.lang.String val,
java.util.Locale l)
Converts the YORN value to Store YORN value
|
static int |
dateTimePartToPosition(int tokennum,
java.lang.String pattern)
Returns the position of d,M,y,H,m,s for the pattern.
|
static java.lang.String |
dateTimeToParseString(java.util.Date d)
Convert a date to a parse date time string using the default locale and time zone
|
static java.lang.String |
dateTimeToParseString(java.util.Date d,
java.util.Locale l)
Convert a date to a parse datetime string using the specified locale and default time zone.
|
static java.lang.String |
dateTimeToParseString(java.util.Date d,
java.util.Locale l,
java.util.TimeZone tz)
Convert a date to a parse datetime string using the specified locale and time zone.
|
static java.lang.String |
dateTimeToSQLString(java.util.Date d)
Convert a date to date time string of format yyyy-MM-dd HH:mm:ss for use
in database queries.
|
static java.lang.String |
dateTimeToString(java.util.Date d)
Convert a date to a date time string using the default locale and time zone
|
static java.lang.String |
dateTimeToString(java.util.Date d,
java.util.Locale l)
Convert a date to a datetime string using the specified locale and default time zone.
|
static java.lang.String |
dateTimeToString(java.util.Date d,
java.util.Locale l,
java.util.TimeZone tz)
Convert a date to a datetime string using the specified locale and time zone.
|
static java.lang.String |
dateTimeToString(java.util.Date date,
java.lang.String dateFormat,
java.util.Locale l,
java.util.TimeZone tz) |
static java.lang.String |
dateToSQLString(java.util.Date d)
Convert a date to date time string of format yyyy-MM-dd for use
in database queries.
|
static java.lang.String |
dateToString(java.util.Date d)
Convert a date to a string using the default locale and time zone.
|
static java.lang.String |
dateToString(java.util.Date d,
java.util.Locale l)
Convert a date to string using the specidied locale and default time zone
|
static java.lang.String |
dateToString(java.util.Date d,
java.util.Locale l,
java.util.TimeZone tz)
Convert a date to a string using the specified locale and time zone.
|
static java.lang.String |
doubleToDuration(double d)
Convert a double value to a duration string using the default locale
|
static java.lang.String |
doubleToDuration(double d,
java.util.Locale l)
Convert a double value to a string using the specified locale.
|
static java.lang.String |
doubleToString(double d)
Convert a double to a string using the default locale
|
static java.lang.String |
doubleToString(double d,
int places)
Convert a double to string, with a set number of decimal places.
|
static java.lang.String |
doubleToString(double d,
int places,
java.util.Locale l)
Convert a double to a string, setting the number of decimal places using
the specified locale.
|
static java.lang.String |
doubleToString(double d,
int places,
java.util.Locale l,
boolean groupingInFormat)
Convert a double to a string, setting the number of decimal places using
the specified locale.
|
static java.lang.String |
doubleToString(double d,
java.util.Locale l)
Conver a double to a string using the specified locale
|
static double |
durationToDouble(java.lang.String s)
Convert a duration string to a double value.
|
static double |
durationToDouble(java.lang.String s,
java.util.Locale l)
Convert a duation string to a double value using the specified locale.
|
static boolean |
formatHasTimeZone(java.lang.String format)
Does this date/time format contain a time zone character.
|
static java.lang.String |
formatRemoveTimeZone(java.lang.String format)
Remove time zone characters from date/time format.
|
static java.lang.String |
getAmountRegex(java.util.Locale locale)
returns amount regex based on locale
|
static java.util.Map<java.lang.String,java.lang.String[]> |
getConvertedTypes()
Get the string representation as in MAXTYPE domain of the maxtype by integer.
|
static java.util.Date |
getDateOnly(java.util.Date date)
Set time portion of passed date to 00:00:00
|
static java.lang.String |
getDatePattern(java.util.Locale l)
Returns the date pattern for UI framework.
|
static java.util.Date |
getDateTimeHHMMOnly(java.util.Date date)
Set seconds and milliseconds to 0.
|
static java.lang.String |
getDateTimePattern(java.util.Locale l)
Returns the parse date time pattern for UI framework.
|
static java.lang.String |
getDisplayNoValue(java.util.Locale l)
Get the display NO value from the locale properties file
|
static java.lang.String |
getDisplayTimePattern(java.util.Locale l)
Returns the parse time pattern for UI framework.
|
static java.lang.String |
getDisplayYesValue(java.util.Locale l)
Get the display YES value from the locale properties file
|
static int |
getMaxTypeAsInt(java.lang.String type)
Get the the MAXTYPE type as int value
|
static java.util.Map<java.lang.String,java.lang.String[]> |
getRepresentedTypes()
Get the string representation as in MAXTYPE domain of the maxtype by integer.
|
static java.lang.String |
getStoreNoValue()
Get the store NO value from the database
|
static java.lang.String |
getStoreYesValue()
Get the store YES value from the database
|
static java.lang.String |
getTimePattern(java.util.Locale l)
Returns the parse time pattern for UI framework.
|
static java.lang.String |
intToString(int i)
Convert an integer to a string using the default locale.
|
static java.lang.String |
intToString(int i,
java.util.Locale l)
convert an integer to a string using the specified locale.
|
static boolean |
isTimePartEntered(java.lang.String s,
java.util.Locale l)
Helper method to find time part is entered in string or not.
|
static boolean |
isValidChar(java.lang.String checkString)
Checks to see if the input string contains valid characters for the database.
|
static java.util.Date |
jmigStringToDateTime(java.lang.String s)
Convert a dateTime String in ISO 8601 format to a Date object
|
static java.lang.String |
longToString(long i)
Convert a long to a string using the default locale.
|
static java.lang.String |
longToString(long i,
java.util.Locale l)
convert a long to a string using the specified locale.
|
static int[] |
parseDateTime(java.lang.String s,
java.util.Locale l,
java.lang.String pattern)
Break a date, datetime or time string into constituent parts.
|
static void |
setSettingProp(java.lang.String propName,
java.lang.String propValue)
Save a value for setting property.
|
static java.util.Date |
sqlWindowsStringToDateTime(java.lang.String s)
Convert a string to a date using the specified locale and time zone
|
static double |
stringToAmount(java.lang.String s)
convert and amount string to a double using the default locale
|
static double |
stringToAmount(java.lang.String s,
java.util.Locale l)
Convert and amount string to a double using the specified locale.
|
static boolean |
stringToBoolean(java.lang.String s)
Convert a string to a boolean value with default locale
|
static boolean |
stringToBoolean(java.lang.String s,
java.util.Locale l)
Convert a string to a boolean value specific locale
|
static java.lang.String |
stringToCodepoints(java.lang.String theString,
boolean escapeSpace,
boolean escapeUnicode)
Converts unicodes to encoded \uxxxx
and writes out any of the characters in specialSaveChars with a preceding slash
|
static java.util.Date |
stringToDate(java.lang.String s)
Convert a string to a date using the default locale amd default time zone
|
static java.util.Date |
stringToDate(java.lang.String s,
java.util.Locale l)
Convert a string to a date using the specified locale and default time zone
|
static java.util.Date |
stringToDate(java.lang.String s,
java.util.Locale l,
java.util.TimeZone tz)
Convert a string to a date using the specified locale and time zone
|
static java.util.Date |
stringToDate(java.lang.String strDate,
java.lang.String strFormat)
Convert a string to date using the specidied format
|
static java.util.Date |
stringToDateTime(java.lang.String s)
Convert a datetime string to a date using the default locale and time zone.
|
static java.util.Date |
stringToDateTime(java.lang.String s,
java.util.Locale l)
Convert datetime string to a date using the specified locale and default time zone.
|
static java.util.Date |
stringToDateTime(java.lang.String s,
java.util.Locale l,
java.util.TimeZone tz)
Convert a datetime string to a date using the specified locale and time zone.
|
static double |
stringToDouble(java.lang.String s)
Convert a string to a double using the default locale.
|
static double |
stringToDouble(java.lang.String s,
java.util.Locale l)
convert a double to string using the specified locale
|
static double |
stringToDouble(java.lang.String s,
java.util.Locale l,
boolean userUIMod)
convert a string to double using the specified locale.
|
static int |
stringToInt(java.lang.String s)
Convert a string to an integer using the default locale
|
static int |
stringToInt(java.lang.String s,
java.util.Locale l)
Convert a string to an integer using the specified locale
|
static int |
stringToIntAsBindNumber(java.lang.String s)
Convert a string to an integer expecting it to be the bind number in the sql statement.
|
static long |
stringToLong(java.lang.String s)
Convert a string to a long using the default locale
|
static long |
stringToLong(java.lang.String s,
java.util.Locale l)
Convert a string to a long using the specified locale
|
static java.util.Date |
stringToTime(java.lang.String s)
Convert a time string to a date using the default locale and time zone.
|
static java.util.Date |
stringToTime(java.lang.String s,
java.util.Locale l)
Convert a time string to a date using the specified locale and default time zone.
|
static java.util.Date |
stringToTime(java.lang.String s,
java.util.Locale l,
java.util.TimeZone tz)
Convert a time string to a date using the specified locale and time zone.
|
static java.util.TimeZone |
stringToTimeZone(java.lang.String d,
java.util.Locale l,
java.lang.String timeFormat,
java.util.TimeZone defaultTZ)
Parse the Date string and return the time zone.
|
static boolean |
supports24Hours(java.util.Locale l)
Returns if Parse time is 24 hour format or not.
|
static java.lang.String |
timeToParseString(java.util.Date d,
java.util.Locale l)
Convert a date to a parse time string using the specified locale and default time zone.
|
static java.lang.String |
timeToParseString(java.util.Date d,
java.util.Locale l,
java.util.TimeZone tz)
Convert a date to parse time string using the specified locale and time zone.
|
static java.lang.String |
timeToParsetring(java.util.Date d)
Convert a date to a parse time string using the default locale and time zone.
|
static java.lang.String |
timeToSQLString(java.util.Date d)
Convert a date to time string of format HH:mm:ss for use
in database queries.
|
static java.lang.String |
timeToString(java.util.Date d)
Convert a date to a time string using the default locale and time zone.
|
static java.lang.String |
timeToString(java.util.Date d,
java.util.Locale l)
Convert a date to a time string using the specified locale and default time zone.
|
static java.lang.String |
timeToString(java.util.Date d,
java.util.Locale l,
java.util.TimeZone tz)
Convert a date to time string using the specified locale and time zone.
|
static char |
toHex(int nibble)
Convert a nibble to a hex character
|
static boolean |
validateAmountAgainstLocaleFormat(java.lang.String s,
java.util.Locale l) |
static boolean |
validateDoubleAgainstLocaleFormat(java.lang.String s,
java.util.Locale l) |
static boolean |
validateEnteredValueAgainstLocaleFormat(java.lang.String s,
java.util.Locale l,
java.lang.String regEx) |
static boolean |
validateFloatAgainstLocaleFormat(java.lang.String s,
java.util.Locale l) |
public static final int ALN
public static final int UPPER
public static final int LOWER
public static final int DATE
public static final int DATETIME
public static final int TIME
public static final int INTEGER
public static final int SMALLINT
public static final int FLOAT
public static final int DECIMAL
public static final int DURATION
public static final int AMOUNT
public static final int YORN
public static final int GL
public static final int LONGALN
public static final int CRYPTO
public static final int CRYPTOX
public static final int CLOB
public static final int BLOB
public static final int BIGINT
public static final int UDTYPE
public static java.lang.String[] TYPEASSTRING
public static final int UNLIMITEDPLACES
public static final java.lang.String TIMESEP
public static final java.lang.String DATESEP
public static final char YEARCHAR
public static final char MONTHCHAR
public static final char DAYCHAR
public static final char AMCHAR
public static final char MINCHAR
public static final char HOUR24CHAR
public static final char HOUR12CHAR
public static final char SECONDCHAR
public static final char GENTIMEZONECHAR
public static final char RFCTIMEZONECHAR
public static final char ISOTIMEZONECHAR
public static final java.lang.String SEPERATORS
public static final java.lang.String SEPERATORS_FR
public static final double MINSPERHOUR
public static final java.lang.String SPECIALSAVECHARS
public static final char[] HEXDIGITS
public static boolean validateDoubleAgainstLocaleFormat(java.lang.String s, java.util.Locale l) throws java.lang.Exception
java.lang.Exception
public static boolean validateAmountAgainstLocaleFormat(java.lang.String s, java.util.Locale l) throws java.lang.Exception
java.lang.Exception
public static boolean validateFloatAgainstLocaleFormat(java.lang.String s, java.util.Locale l) throws java.lang.Exception
java.lang.Exception
public static boolean validateEnteredValueAgainstLocaleFormat(java.lang.String s, java.util.Locale l, java.lang.String regEx) throws java.lang.Exception
java.lang.Exception
public static java.lang.String getAmountRegex(java.util.Locale locale)
public static int stringToInt(java.lang.String s) throws MXApplicationException
MXApplicationException
public static int stringToInt(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static int stringToIntAsBindNumber(java.lang.String s) throws MXApplicationException
MXApplicationException
public static long stringToLong(java.lang.String s) throws MXApplicationException
MXApplicationException
public static long stringToLong(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static java.lang.String intToString(int i)
public static java.lang.String intToString(int i, java.util.Locale l)
public static java.lang.String longToString(long i)
public static java.lang.String longToString(long i, java.util.Locale l)
public static double stringToAmount(java.lang.String s) throws MXApplicationException
MXApplicationException
public static double stringToAmount(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static java.lang.String amountToString(double d)
public static java.lang.String amountToString(double d, int places)
public static java.lang.String amountToString(double d, int places, java.util.Locale l)
public static double stringToDouble(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static double stringToDouble(java.lang.String s) throws MXApplicationException
MXApplicationException
public static double stringToDouble(java.lang.String s, java.util.Locale l, boolean userUIMod) throws MXApplicationException
MXApplicationException
public static java.lang.String doubleToString(double d)
public static java.lang.String doubleToString(double d, java.util.Locale l)
public static java.lang.String doubleToString(double d, int places)
public static java.lang.String doubleToString(double d, int places, java.util.Locale l)
public static java.lang.String doubleToString(double d, int places, java.util.Locale l, boolean groupingInFormat)
public static double durationToDouble(java.lang.String s) throws MXApplicationException
MXApplicationException
public static double durationToDouble(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static java.lang.String doubleToDuration(double d)
public static java.lang.String doubleToDuration(double d, java.util.Locale l)
public static boolean stringToBoolean(java.lang.String s) throws MXApplicationException
MXApplicationException
public static boolean stringToBoolean(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static java.lang.String booleanToString(boolean b)
public static java.lang.String booleanToString(boolean b, java.util.Locale l)
public static int booleanToInt(boolean b)
public static double booleanToDouble(boolean b)
public static long booleanToLong(boolean b)
public static java.util.Date stringToDate(java.lang.String s) throws MXApplicationException
MXApplicationException
public static java.util.Date stringToDate(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static java.util.Date stringToDate(java.lang.String s, java.util.Locale l, java.util.TimeZone tz) throws MXApplicationException
MXApplicationException
public static java.util.Date stringToDate(java.lang.String strDate, java.lang.String strFormat) throws MXApplicationException
MXApplicationException
public static java.lang.String dateTimeToString(java.util.Date date, java.lang.String dateFormat, java.util.Locale l, java.util.TimeZone tz) throws MXApplicationException
MXApplicationException
public static java.util.Date sqlWindowsStringToDateTime(java.lang.String s) throws MXApplicationException
MXApplicationException
public static java.util.Date jmigStringToDateTime(java.lang.String s) throws MXApplicationException
s
- the dateTime StringMXApplicationException
public static java.lang.String dateToString(java.util.Date d)
public static java.lang.String dateToString(java.util.Date d, java.util.Locale l)
public static java.lang.String dateToString(java.util.Date d, java.util.Locale l, java.util.TimeZone tz)
public static java.util.Date stringToDateTime(java.lang.String s) throws MXApplicationException
MXApplicationException
public static java.util.Date stringToDateTime(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static java.util.Date stringToDateTime(java.lang.String s, java.util.Locale l, java.util.TimeZone tz) throws MXApplicationException
MXApplicationException
public static java.lang.String dateTimeToParseString(java.util.Date d)
public static java.lang.String dateTimeToParseString(java.util.Date d, java.util.Locale l)
public static java.lang.String dateTimeToParseString(java.util.Date d, java.util.Locale l, java.util.TimeZone tz)
public static java.lang.String dateTimeToString(java.util.Date d)
public static java.lang.String dateTimeToString(java.util.Date d, java.util.Locale l)
public static java.lang.String dateTimeToString(java.util.Date d, java.util.Locale l, java.util.TimeZone tz)
public static java.lang.String dateTimeToSQLString(java.util.Date d)
public static java.lang.String dateToSQLString(java.util.Date d)
public static java.lang.String timeToSQLString(java.util.Date d)
public static java.util.Date stringToTime(java.lang.String s) throws MXApplicationException
MXApplicationException
public static java.util.Date stringToTime(java.lang.String s, java.util.Locale l) throws MXApplicationException
MXApplicationException
public static java.util.Date stringToTime(java.lang.String s, java.util.Locale l, java.util.TimeZone tz) throws MXApplicationException
MXApplicationException
public static java.lang.String timeToParsetring(java.util.Date d)
public static java.lang.String timeToParseString(java.util.Date d, java.util.Locale l)
public static java.lang.String timeToParseString(java.util.Date d, java.util.Locale l, java.util.TimeZone tz)
public static java.lang.String timeToString(java.util.Date d)
public static java.lang.String timeToString(java.util.Date d, java.util.Locale l)
public static java.lang.String timeToString(java.util.Date d, java.util.Locale l, java.util.TimeZone tz)
public static java.util.Date getDateOnly(java.util.Date date)
date
- public static java.util.Date getDateTimeHHMMOnly(java.util.Date date)
date
- public static int getMaxTypeAsInt(java.lang.String type)
public static int[] parseDateTime(java.lang.String s, java.util.Locale l, java.lang.String pattern) throws MXApplicationException
MXApplicationException
public static boolean isTimePartEntered(java.lang.String s, java.util.Locale l)
s
- l
- pattern
- public static java.lang.String getStoreYesValue()
public static java.lang.String getStoreNoValue()
public static java.lang.String getDisplayYesValue(java.util.Locale l)
public static java.lang.String getDisplayNoValue(java.util.Locale l)
public static java.lang.String convertToStoreYNValue(java.lang.String val, java.util.Locale l) throws MXException
MXException
public static java.lang.String clobToString(java.sql.Clob c)
c
- Clobpublic static byte[] blobToBytes(java.sql.Blob b)
b
- Blobpublic static java.lang.String getDatePattern(java.util.Locale l)
l
- t
- public static java.lang.String getTimePattern(java.util.Locale l)
l
- t
- public static java.lang.String getDisplayTimePattern(java.util.Locale l)
l
- t
- public static java.lang.String getDateTimePattern(java.util.Locale l)
l
- t
- public static boolean supports24Hours(java.util.Locale l)
l
- public static int dateTimePartToPosition(int tokennum, java.lang.String pattern)
tokennum
- 0 - day, 1- month, 2- year, 3- hour, 4 -minute, 5 - secondpattern
- public static java.lang.String stringToCodepoints(java.lang.String theString, boolean escapeSpace, boolean escapeUnicode)
String
- - the string to convert into code points.escapeSpace
- - flag for escpaing space in the stringescapeUnicode
- - flag for escaping the slah in the unicode codepoint (For browser script/HTML)public static void setSettingProp(java.lang.String propName, java.lang.String propValue)
propName
- Property namepropValue
- Property valuepublic static char toHex(int nibble)
nibble
- the nibble to convert.public static boolean isValidChar(java.lang.String checkString)
checkString
- the string to be checkedpublic static java.util.Map<java.lang.String,java.lang.String[]> getConvertedTypes()
i
- public static java.util.Map<java.lang.String,java.lang.String[]> getRepresentedTypes()
i
- public static boolean formatHasTimeZone(java.lang.String format)
format
- public static java.lang.String formatRemoveTimeZone(java.lang.String format)
format
- Date/Time format stringpublic static java.util.TimeZone stringToTimeZone(java.lang.String d, java.util.Locale l, java.lang.String timeFormat, java.util.TimeZone defaultTZ)
d
- Date Stringl
- LocaletimeFormat
- Date/Time format stringdefaultTZ
- Default Time Zone