|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface UtilityContext
Extends the basic context to provide generic utility functions that most templates will need to use for formatting.
| Method Summary | ||
|---|---|---|
void |
append(StringBuilder buffer,
Object value)
A function to append a value to an existing buffer. |
|
String |
cardinal(long n)
A function that converts an integer to a cardinal value. |
|
String |
cardinal(Long n)
A function that converts an integer to a cardinal value. |
|
StringBuilder |
createStringBuilder()
A function that creates a string builder to allow programs to perform concatenation and pass around strings. |
|
StringBuilder |
createStringBuilder(int size)
A function that creates a string builder to allow programs to perform concatenation and pass around strings. |
|
Date |
currentDate()
Returns a standard Java Date object with the current date and time. |
|
org.joda.time.DateTime |
currentDateTime()
Returns a Joda DateTime object with the current date and time. |
|
boolean |
endsWith(String str,
String suffix)
Tests if the given string ends with the given suffix. |
|
int[] |
find(String str,
String search)
Finds the indices for each occurrence of the given search string in the source string. |
|
int[] |
find(String str,
String search,
int fromIndex)
Finds the indices for each occurrence of the given search string in the source string, starting from the given index. |
|
int |
findFirst(String str,
String search)
Finds the index of the first occurrence of the given search string in the source string, or -1 if not found. |
|
int |
findFirst(String str,
String search,
int fromIndex)
Finds the index of the first occurrence of the given search string in the source string, starting from the given index, or -1 if not found. |
|
int |
findLast(String str,
String search)
Finds the index of the last occurrence of the given search string in the source string, or -1 if not found. |
|
int |
findLast(String str,
String search,
int fromIndex)
Finds the index of the last occurrence of the given search string in the source string, starting from the given index, or -1 if not found. |
|
void |
insert(StringBuilder buffer,
Object value,
int index)
A function to insert a value into an existing buffer. |
|
boolean |
isArray(Object o)
A function that checks if an object is an Array |
|
String |
ordinal(long n)
A function that converts an integer to an ordinal value. |
|
String |
ordinal(Long n)
A function that converts an integer to an ordinal value. |
|
void |
prepend(StringBuilder buffer,
Object value)
A function to prepend a value to an existing buffer. |
|
|
replace(String source,
Map<K,V> patternReplacements)
Applies string replacements using the pattern-replacement pairs provided by the given map (associative array). |
|
String |
replace(String source,
String pattern,
String replacement)
Replaces all exact matches of the given pattern in the source string with the provided replacement. |
|
String |
replace(String source,
String pattern,
String replacement,
int fromIndex)
Replaces all exact matches of the given pattern in the source string with the provided replacement, starting from the given index. |
|
String |
replaceFirst(String source,
String pattern,
String replacement)
Replaces the first exact match of the given pattern in the source string with the provided replacement. |
|
String |
replaceFirst(String source,
String pattern,
String replacement,
int fromIndex)
Replaces the first exact match of the given pattern in the source string with the provided replacement, starting from the given index. |
|
String |
replaceLast(String source,
String pattern,
String replacement)
Replaces the last exact match of the given pattern in the source string with the provided replacement. |
|
String |
replaceLast(String source,
String pattern,
String replacement,
int fromIndex)
Replaces the last exact match of the given pattern in the source string with the provided replacement, starting from the given index. |
|
String |
shortOrdinal(long n)
A function that converts an integer to a short ordinal value. |
|
String |
shortOrdinal(Long n)
A function that converts an integer to a short ordinal value. |
|
void |
sort(Object[] array,
boolean sortAscending)
|
|
void |
sort(Object[] array,
String[] onColumns,
boolean[] reverse)
|
|
void |
sort(Object[] array,
String onColumn,
boolean reverse)
|
|
void |
sort(String[] array,
boolean reverse,
boolean ignoreCase)
|
|
void |
sortAscending(byte[] array)
|
|
void |
sortAscending(double[] array)
|
|
void |
sortAscending(float[] array)
|
|
void |
sortAscending(int[] array)
|
|
void |
sortAscending(long[] array)
|
|
void |
sortAscending(Object[] array)
|
|
void |
sortAscending(short[] array)
|
|
String[] |
split(String str,
String regex)
|
|
boolean |
startsWith(String str,
String prefix)
Tests if the given string starts with the given prefix. |
|
String |
substring(String str,
int startIndex)
Returns the trailing end of the given string, starting from the given index. |
|
String |
substring(String str,
int startIndex,
int endIndex)
Returns a sub-portion of the given string for the characters that are at or after the starting index, and are before the end index. |
|
String |
toLowerCase(String str)
Converts all the characters in the given string to lowercase. |
|
String |
toString(StringBuilder buffer)
A function to convert the buffer into a standard string. |
|
String |
toUpperCase(String str)
Converts all the characters in the given string to uppercase. |
|
String |
trim(String str)
Trims all leading and trailing whitespace characters from the given string. |
|
String |
trimLeading(String str)
Trims all leading whitespace characters from the given string. |
|
String |
trimTrailing(String str)
Trims all trailing whitespace characters from the given string. |
|
| Methods inherited from interface org.teatrove.tea.runtime.Context |
|---|
dateFormat, dateFormat, getAvailableLocales, getAvailableTimeZones, getDateFormat, getDateFormatTimeZone, getLocale, getNullFormat, getNumberFormat, getNumberFormatInfinity, getNumberFormatNaN, nullFormat, numberFormat, numberFormat, print, print, print, print, print, print, print, print, setLocale, setLocale, setLocale, toString, toString, toString, toString, toString, toString, toString, toString, toString |
| Methods inherited from interface org.teatrove.tea.runtime.OutputReceiver |
|---|
write, write, write, write, write |
| Method Detail |
|---|
Date currentDate()
org.joda.time.DateTime currentDateTime()
boolean startsWith(String str,
String prefix)
str - the source stringprefix - the prefix to test for
boolean endsWith(String str,
String suffix)
str - the source stringsuffix - the suffix to test for
int[] find(String str,
String search)
str - the source stringsearch - the string to search for
int[] find(String str,
String search,
int fromIndex)
str - the source stringsearch - the string to search forfromIndex - index to start the find
int findFirst(String str,
String search)
str - the source stringsearch - the string to search for
int findFirst(String str,
String search,
int fromIndex)
str - the source stringsearch - the string to search forfromIndex - index to start the find
int findLast(String str,
String search)
str - the source stringsearch - the string to search for
int findLast(String str,
String search,
int fromIndex)
str - the source stringsearch - the string to search forfromIndex - optional index to start the find
String substring(String str,
int startIndex)
str - the source stringstartIndex - the start index, inclusive
String substring(String str,
int startIndex,
int endIndex)
str - the source stringstartIndex - the start index, inclusiveendIndex - the ending index, exclusive
String toLowerCase(String str)
str - the string to convert
String toUpperCase(String str)
str - the string to convert
String trim(String str)
str - the string to trim
String trimLeading(String str)
str - the string to trim
String trimTrailing(String str)
str - the string to trim
String replace(String source,
String pattern,
String replacement)
source - the source stringpattern - the simple string pattern to search forreplacement - the string to use for replacing matched patterns.
String replace(String source,
String pattern,
String replacement,
int fromIndex)
source - the source stringpattern - the simple string pattern to search forreplacement - the string to use for replacing matched patterns.fromIndex - index to start the replace
<K,V> String replace(String source,
Map<K,V> patternReplacements)
source - the source stringpatternReplacements - pattern-replacement pairs
String replaceFirst(String source,
String pattern,
String replacement)
source - the source stringpattern - the simple string pattern to search forreplacement - the string to use for replacing matched patterns
String replaceFirst(String source,
String pattern,
String replacement,
int fromIndex)
source - the source stringpattern - the simple string pattern to search forreplacement - the string to use for replacing matched patternsfromIndex - index to start the replace
String replaceLast(String source,
String pattern,
String replacement)
source - the source stringpattern - the simple string pattern to search forreplacement - the string to use for replacing matched patterns
String replaceLast(String source,
String pattern,
String replacement,
int fromIndex)
source - the source stringpattern - the simple string pattern to search forreplacement - the string to use for replacing matched patternsfromIndex - index to start the replace
String shortOrdinal(Long n)
n - the number to convert
String shortOrdinal(long n)
n - the number to convert
String ordinal(Long n)
n - the number to convert
String ordinal(long n)
n - the number to convert
String cardinal(Long n)
n - the number to convert
String cardinal(long n)
n - the number to convert
boolean isArray(Object o)
o - the Object to check
void sort(Object[] array,
String onColumn,
boolean reverse)
void sort(Object[] array,
String[] onColumns,
boolean[] reverse)
void sort(String[] array,
boolean reverse,
boolean ignoreCase)
void sort(Object[] array,
boolean sortAscending)
void sortAscending(Object[] array)
void sortAscending(int[] array)
void sortAscending(double[] array)
void sortAscending(float[] array)
void sortAscending(byte[] array)
void sortAscending(short[] array)
void sortAscending(long[] array)
String[] split(String str,
String regex)
StringBuilder createStringBuilder()
StringBuilder createStringBuilder(int size)
size - the initial size of the buffer
void append(StringBuilder buffer,
Object value)
buffer - the buffer to append tovalue - the value to append
void prepend(StringBuilder buffer,
Object value)
buffer - the buffer to prepend tovalue - the value to prepend
void insert(StringBuilder buffer,
Object value,
int index)
buffer - the buffer to insert intovalue - the value to insertindex - the index of the position to insert atString toString(StringBuilder buffer)
buffer - the buffer to convert
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||