|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.scaffold.text.ConvertUtils
public class ConvertUtils
An experimental class with some standard conversion utilities. Needs more proof of concept and unit testing.
Field Summary | |
---|---|
static char |
CARRIAGE_RETURN
Carriage return character. |
static String |
CURRENCY_PATTERN
Standard currency pattern. |
static String |
DATE_SEPARATOR
Date separator ["-"]. |
static String |
DATE_TIME_SEPARATOR
Date Time separator [" "]. |
static String |
DECIMAL_PATTERN
Default decimal pattern. |
static int |
DEFAULT
Default style for dates and times. |
static Double |
DOUBLE_ONE
An Double 1. |
static Double |
DOUBLE_ZERO
An Double 0. |
static String |
EMPTY_STRING
Deprecated. Use STRING_EMPTY |
static String |
ESCAPE_DATE_PATTERN
A "default" date format. |
static char |
FILE_SEPARATOR
File separator character. |
static char |
FORM_FEED
Form feed character. |
static int |
FULL
Full style for dates and times. |
static char |
GROUP_SEPARATOR
Group separator character. |
static char |
HORIZONTAL_TABULATION
Horizontal tab character. |
static Integer |
INTEGER_ONE
An Integer 1. |
static Integer |
INTEGER_ZERO
An Integer 0. |
static char |
LINE_FEED
Line feed character. |
static int |
LONG
Long style for dates and times. |
static Timestamp |
MAX_TIMESTAMP
Timestamp representing "December 31, 2029, 23:59:59.9" |
static int |
MEDIUM
Medium style for dates and times. |
static long |
NULL_TIME
Value needed to create Timestamp representing "January 1, 1970 00:00:00". |
static Timestamp |
NULL_TIMESTAMP
Timestamp representing "January 1, 1970 00:00:00". |
static String |
NULL_TIMESTAMP_DISPLAY
Escape string to create Timestamp representing "January 1, 1970 00:00:00". |
static String |
NULL_TIMESTAMP_TEXT
Deprecated. Use NULL_TIMESTAMP_DISPLAY. |
static String |
QS_DELIM
The token that delimits two or more attributes of a query string ["&"]. |
static String |
QS_SEP
The token that seperates an attribute name and value. |
static String |
QS_START
The token that signifies the begnning of a query string ["?"]. |
static char |
RECORD_SEPARATOR
Record separator character. |
static char[] |
SEPARATORS
Array of line separator characters. |
static int |
SHORT
Short style for dates and times. |
static Short |
SHORT_ONE
A Short 1. |
static Short |
SHORT_ZERO
A Short 0. |
static char |
SPACE
Space character. |
static String |
STRING_EMPTY
An empty string. |
static String |
STRING_ONE
A String 1. |
static String |
STRING_SPACE
An single-space string. |
static String |
STRING_ZERO
A String 0. |
static String |
TIME_SEPARATOR
Time separator [":"]. |
static String |
TIMESTAMP_DATE_ZERO
String to prepend to time [HH:MM:SS.d] to create a Timestamp escape string ["0002-11-30"]. |
static String |
TIMESTAMP_TIME_ZERO
String to append to date [YEAR-MM-DD] to create a Timestamp escape string [" 00:00:00.0"]. |
static char |
UNIT_SEPARATOR
Unit separator character. |
static char |
VERTICAL_TABULATION
Vertical tab character. |
static Timestamp |
ZERO_TIMESTAMP
Timestamp representing ""November 30, 0002 00:00:00". |
static String |
ZERO_TIMESTAMP_DISPLAY
Escape string representing "November 30, 0002 00:00:00". |
Method Summary | |
---|---|
static String |
addLuhnDigit(String number)
Returns number with the appropriate digit appended so that is passes a "luhnCheck". |
static String |
addParam(String path,
String name,
String value)
Appends name=value parameter. |
static String |
addParams(String path,
Map parameters)
Appends name=value parameters to path from Map. |
static boolean |
blank(Number key)
Deprecated. Use blank instead. |
static boolean |
blank(String s)
Deprecated. Use blank instead. |
static boolean |
blankValue(String s)
Returns true if null, trims to an empty string, or to "0". |
static String |
getCurrency(Number value)
Return currency for default locale using standard pattern. |
static String |
getDate(Date date)
Convert date to String for default locale in DEFAULT style. |
static String |
getDate(Date date,
int style)
Convert date to String for default locale in given style. |
static String |
getDate(Date date,
Locale locale,
int style)
Convert date to String for given locale in given style. |
static Date |
getDate(String dateDisplay)
Convert String to Date using a medium (weekday day month year) format. |
static Date |
getDate(String dateDisplay,
String format)
Convert String to Date using given format. |
static Date |
getDate(String dateDisplay,
String format,
boolean lenient)
Convert String to Date using given format. |
static String |
getDecimal(Number value)
Return decimal for default locale using standard pattern. |
static String |
getDecimal(Number value,
Locale locale)
Return decimal number formatted for default or given locale. |
static String |
getDecimal(Number value,
Locale locale,
String pattern)
Return decimal number formatted for default or given locale using given pattern. |
static String |
getDigits(String s)
Return String with of digits only (0..9). |
static DecimalFormatSymbols |
getGenericDecimal(Locale locale)
Symbols that can be used in a decimal pattern. |
static String |
getNumber(Number value,
Locale locale)
Returns number formatted for default or given locale. |
static String |
getPercent(Number value,
Locale locale)
Returns percent formatted for default or given locale. |
static Timestamp |
getTimestamp()
Factory method to return timestamp initialized to current system time. |
static String |
getTimestamp(Timestamp timestamp)
Convert date to String for default locale in DEFAULT style. |
static String |
getTimestamp(Timestamp timestamp,
int style)
Convert date to String for default locale in given style. |
static String |
getTimestamp(Timestamp timestamp,
Locale locale,
int style)
Convert timestamp to String for given locale in given style. |
static String |
getTimestampDisplay()
Return the String representing the current timestamp; |
static String |
getTimestampDisplayNull()
Return the String representing "January 1, 1970 00:00:00". |
static String |
getTimestampText()
Deprecated. Use getTimestampDisplay. |
static Integer |
ipNode(String ipAddress)
Return the integer value of an IP address in dotted octet form, like that returned by request.getRemotehost). |
static boolean |
isBlank(Integer key)
Deprecated. Use blank instead. |
static boolean |
isBlank(String s)
Deprecated. Use blank instead. |
static boolean |
isBlankValue(String s)
Deprecated. Use blankValue instead. |
static boolean |
isNull(Timestamp timestamp)
Return null if timestamp is null or equals "January 1, 1970 00:00:00". |
static boolean |
luhnCheck(String number)
|
static String |
renderHiddenFields(Map parameters)
Returns parameters as a series of hidden HTML fields. |
static Date |
toDate(String string)
Return Date value using a String. |
static String |
toEscape(Date date)
Return String value representing Date. |
static String[] |
tokensToArray(String tokens,
String separator)
Return array of tokens, using the result of getTokeSep() as the
separator. |
static List |
tokensToList(String tokens,
String separator)
Return list of tokens, using the result of getTokeSep() as the
separator. |
static String |
toString(Date date)
Return String value representing Date. |
static String |
toString(Timestamp timestamp)
Return String value representing Timestamp. |
static Timestamp |
toTimestamp(String string)
Return Timestamp value using a String. |
static Timestamp |
toTimestamp(String year,
String month,
String day)
Return a Timestamp based on the parameters. |
static String |
toTrimOrEmpty(String string)
Return a trimmed or empty string (but not null). |
static String |
toUpperOrNull(String string)
Returns null or a trimmed uppercase string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String STRING_EMPTY
public static String EMPTY_STRING
public static final String STRING_SPACE
public static final char SPACE
public static final char HORIZONTAL_TABULATION
public static final char LINE_FEED
public static final char VERTICAL_TABULATION
public static final char FORM_FEED
public static final char CARRIAGE_RETURN
public static final char FILE_SEPARATOR
public static final char GROUP_SEPARATOR
public static final char RECORD_SEPARATOR
public static final char UNIT_SEPARATOR
public static final char[] SEPARATORS
public static String QS_START
public static String QS_DELIM
public static String QS_SEP
public static Double DOUBLE_ZERO
public static Double DOUBLE_ONE
public static Integer INTEGER_ZERO
public static Integer INTEGER_ONE
public static Short SHORT_ZERO
public static Short SHORT_ONE
public static String STRING_ZERO
public static String STRING_ONE
public static String DECIMAL_PATTERN
public static String CURRENCY_PATTERN
public static int DEFAULT
public static int SHORT
public static int MEDIUM
public static int LONG
public static int FULL
public static String ESCAPE_DATE_PATTERN
public static final String DATE_SEPARATOR
public static final String TIME_SEPARATOR
public static final String DATE_TIME_SEPARATOR
public static final String TIMESTAMP_DATE_ZERO
public static final String TIMESTAMP_TIME_ZERO
public static String ZERO_TIMESTAMP_DISPLAY
public static Timestamp ZERO_TIMESTAMP
public static String NULL_TIMESTAMP_DISPLAY
public static String NULL_TIMESTAMP_TEXT
public static long NULL_TIME
public static Timestamp NULL_TIMESTAMP
public static Timestamp MAX_TIMESTAMP
Method Detail |
---|
public static String[] tokensToArray(String tokens, String separator)
getTokeSep()
as the
separator.
Blanks are trimmed from tokens.
parameter
- The string to tokenize into an arraypublic static List tokensToList(String tokens, String separator)
getTokeSep()
as the
separator.
Blanks are trimmed from tokens.
parameter
- The string to tokenize into an arraypublic static boolean isBlank(String s)
public static boolean isBlank(Integer key)
public static boolean isBlankValue(String s)
public static boolean blank(String s)
public static boolean blank(Number key)
public static boolean blankValue(String s)
public static String toTrimOrEmpty(String string)
public static String toUpperOrNull(String string)
public static String addParam(String path, String name, String value)
public static String addParams(String path, Map parameters)
public static String renderHiddenFields(Map parameters)
public static String getDigits(String s)
public static String getNumber(Number value, Locale locale)
public static String getPercent(Number value, Locale locale)
public static boolean luhnCheck(String number)
public static String addLuhnDigit(String number)
Number
- - Number to process.
Must be all digits and not null.public static DecimalFormatSymbols getGenericDecimal(Locale locale)
public static String getDecimal(Number value, Locale locale)
public static String getDecimal(Number value, Locale locale, String pattern)
public static String getDecimal(Number value)
public static String getCurrency(Number value)
public static Date getDate(String dateDisplay, String format, boolean lenient)
public static Date getDate(String dateDisplay, String format)
public static Date getDate(String dateDisplay)
public static Date toDate(String string)
String
- representing Datepublic static String getDate(Date date, Locale locale, int style)
public static String getDate(Date date, int style)
public static String getDate(Date date)
public static String toString(Date date)
Date
- public static String toEscape(Date date)
Date
- public static String getTimestampDisplayNull()
public static String getTimestampDisplay()
public static String getTimestampText()
public static boolean isNull(Timestamp timestamp)
public static Timestamp getTimestamp()
getTimestamp().toString()
.
public static String getTimestamp(Timestamp timestamp, Locale locale, int style)
public static String getTimestamp(Timestamp timestamp, int style)
public static String getTimestamp(Timestamp timestamp)
public static Timestamp toTimestamp(String string)
String
- representing Timestamppublic static Timestamp toTimestamp(String year, String month, String day)
year
- The yearmonth
- The monthday
- The daypublic static String toString(Timestamp timestamp)
Timestamp
- public static Integer ipNode(String ipAddress)
Timestamp
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |