org.rythmengine.utils
Class S

java.lang.Object
  extended by org.rythmengine.utils.S

public class S
extends Object

A utility class providing String manipulation methods. Commonly used in template engine process.

Note all methods defined in this class is null safe. if any input is null the return value is ""

An instance of this utility is exposed to any Rythm template via TemplateBase.s() method and can be used in template source code freely. E.g.


 @if(s().empty(name)) {
 
user name is empty!
}


Field Summary
static String EMPTY_STR
           
static int IGNORECASE
          The modifier used to indicate the comparison should ignore case
static int IGNORESPACE
          The modifier used to indicate the comparison should ignore space
static S INSTANCE
           
 
Constructor Summary
S()
           
 
Method Summary
static String camelCase(Object obj)
          Turn an object's String representation into Camel Case
static String capFirst(Object o)
          Make the first character be uppercase of the given object's string representation
static String capitalizeWords(Object o)
          Capitalize the first character of every word of the specified object's string representation.
static String[] divide(Object o, String sep)
          Bridge String.split() method to Object
static boolean empty(Object o)
          Alias of isEmpty(Object)
static boolean empty(String s)
          Alias of isEmpty(String)
static boolean eq(Object o1, Object o2)
          Alias of isEqual(Object, Object)
static boolean eq(String s1, String s2)
          Alias of isEqual(String, String)
static boolean eq(String s1, String s2, int modifier)
          Alias of isEqual(String, String, int)
static RawData escape(ITemplate template, Object o)
          The template implicit argument version of escape(Object)
static RawData escape(Object o)
          Return a RawData type wrapper of an object without escaping or if the current template exists return the escape specified by the current escape scheme of the current render template

static RawData escape(Object o, Object escape)
          Return a RawData type wrapper of an object with specified escaping scheme.
static RawData escapeCsv(Object o)
          Alias of escapeCSV(Object)
static RawData escapeCSV(Object o)
          Return a RawData type wrapper of an object with CSV escaping

static RawData escapeHtml(Object o)
          Alias of escapeHTML(Object)
static RawData escapeHTML(Object o)
          Return a RawData type wrapper of an object with HTML escaping

static RawData escapeJava(Object o)
          Return a RawData type wrapper of an object with Java escaping

static RawData escapeJavascript(Object o)
          Alias of escapeJavaScript(Object)
static RawData escapeJavaScript(Object o)
          Return a RawData type wrapper of an object with JavaScript escaping

static RawData escapeJS(Object o)
          Alias of escapeJavaScript(Object)
static RawData escapeJson(Object o)
          Alias of escapeCSV(Object)
static RawData escapeJSON(Object o)
          Return a RawData type wrapper of an object with JSON escaping

static RawData escapeRegex(Object o)
          Escape for regular expression
static RawData escapeXml(Object o)
          Alias of escapeXML(Object)
static RawData escapeXML(Object o)
          Return a RawData type wrapper of an object with XML escaping

static String format(Date date)
          Format a date with engine's default format corresponding to the engine's locale configured
static String format(Date date, String pattern)
          Format a date with specified pattern
static String format(Date date, String pattern, Locale locale)
          Transformer.
static String format(Date date, String pattern, Locale locale, String timezone)
          Transformer.
static String format(ITemplate template, Date date)
          Format a date with specified engine's default format corresponding to the engine's locale configured
static String format(ITemplate template, Date date, String pattern)
          Format a date with specified pattern
static String format(ITemplate template, Date date, String pattern, Locale locale)
          See format(org.rythmengine.template.ITemplate, java.util.Date, String, java.util.Locale, String)
static String format(ITemplate template, Date date, String pattern, Locale locale, String timezone)
          Format a date with specified pattern, lang, locale and timezone.
static String format(ITemplate template, Number number)
          Format number with specified template
static String format(ITemplate template, Number number, String pattern)
          Format a number with specified engine, pattern
static String format(ITemplate template, Number number, String pattern, Locale locale)
          Format the number with specified template, pattern, language and locale
static String format(Number number)
          Format a number using default pattern, language and locale
static String format(Number number, String pattern)
          Format a number with specified pattern
static String format(Number number, String pattern, Locale locale)
          Format the number with specified pattern, language and locale
static String formatCurrency(ITemplate template, Object data)
          See formatCurrency(org.rythmengine.template.ITemplate, Object)
static String formatCurrency(ITemplate template, Object data, String currencyCode)
          See formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)
static String formatCurrency(ITemplate template, Object data, String currencyCode, Locale locale)
          Format give data into currency using locale info from the engine specified
static String formatCurrency(Object data)
          Transformer method.
static String formatCurrency(Object data, String currencyCode)
          Transformer method.
static String formatCurrency(Object data, String currencyCode, Locale locale)
          See formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)
static String formatSize(Object data)
          Format size (e.g.
static String i18n(ITemplate template, String key, Object... args)
          Return i18n message of a given key and args, use the locale info from the template specified.
static String i18n(String key)
           
static String i18n(String key, Object... args)
          Transformer method.
static boolean isDigitsOrAlphabetic(char c)
           
static boolean isEmpty(Object o)
          Determine if a given Object instance is null or empty after it converted to a String.
static boolean isEmpty(String s)
          Determine if a given String is null or empty.
static boolean isEqual(Object o1, Object o2)
          Check if two Object is equal after converted into String
static boolean isEqual(String s1, String s2)
          Check if two String is equal.
static boolean isEqual(String s1, String s2, int modifier)
          Determine whether two string instance is equal based on the modifier passed in.
static boolean isNotEmpty(Object o)
          Determine if a given Object instance is NOT null or empty.
static boolean isNotEmpty(String s)
          Determine if a given String is NOT null or empty.
static boolean isNotEqual(Object o1, Object o2)
          Check if two Object is not equal after converted into String
static boolean isNotEqual(String s1, String s2)
          Check if two String is not equal.
static boolean isNotEqual(String s1, String s2, int modifier)
          The counter function of isEqual(String, String, int)
static String join(Character[] a)
           
static String join(Character[] a, char sep)
           
static String join(Character[] a, String sep)
           
static String join(Double[] a)
           
static String join(Double[] a, char sep)
           
static String join(Double[] a, String sep)
           
static String join(Float[] a)
           
static String join(Float[] a, char sep)
           
static String join(Float[] a, String sep)
           
static String join(Integer[] a)
           
static String join(Integer[] a, char sep)
           
static String join(Integer[] a, String sep)
           
static String join(Iterable itr)
          Join items in an iterable with ","
static String join(Iterable itr, char sep)
          Join an iterable with a char separator
static String join(Iterable itr, String sep)
          Join an iterable with separator
static String join(Long[] a)
           
static String join(Long[] a, char sep)
           
static String join(Long[] a, String sep)
           
static int len(Object o)
          get length of specified object If o is a Collection or Map, then return size of it If o is an array, then return length of it Otherwise return length() of String representation of the object
static String lowerCase(Object o)
          Bridge String.toUpperCase() method to Object
static String lowerFirst(Object o)
          Make the first character be lowercase of the given object's string representation
static boolean ne(Object o1, Object o2)
          Alias of isNotEqual(Object, Object)
static boolean ne(String s1, String s2)
          Alias of isNotEqual(String, String)
static boolean ne(String s1, String s2, int modifier)
          Alias of isNotEqual(String, String, int)
static RawData nl2br(Object data)
          Change line break in the data string into
static RawData nl2br(RawData data)
          Change line break in the data string into
static String noAccents(Object o)
          Replace accent character (usually found in European languages) of the String representation of a give object to non-accent char.
static boolean notEmpty(Object o)
          Alias of isNotEmpty(Object)
static boolean notEmpty(String s)
          Alias of isNotEmpty(String)
static String random()
          Return a random string with 8 chars
static String random(int len)
          Generate random string.
static RawData raw(Object o)
          Return a RawData type wrapper of an object without any escaping.
static String removeAllLineBreaks(Object o)
          Remove all line breaks from string representation of specified object O
static String shrinkSpace(Object o)
          Shrink spaces in an object's string representation by merge multiple spaces, tabs into one space, and multiple line breaks into one line break
static String str(Object o)
          Alias of toString(Object)
static String strip(Object o, String prefix, String suffix)
          Strip the prefix and suffix from an object's String representation and return the result

static String stripBrace(Object o)
          Strip the brace from an object's string representation and return the result
static String stripBraceAndQuotation(Object o)
          Strip off both brace and quotation
static String stripQuotation(Object o)
          Strip the quotation mark from an object's string representation and return the result
static String toString(Object o)
          Safe convert an Object to String.
static String upperCase(Object o)
          Bridge String.toUpperCase() method to Object
static String urlEncode(Object data)
          encode using utf-8
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final S INSTANCE

EMPTY_STR

public static final String EMPTY_STR
See Also:
Constant Field Values

IGNORECASE

public static final int IGNORECASE
The modifier used to indicate the comparison should ignore case

See Also:
isEqual(String, String, int), Constant Field Values

IGNORESPACE

public static final int IGNORESPACE
The modifier used to indicate the comparison should ignore space

See Also:
isEqual(String, String, int), Constant Field Values
Constructor Detail

S

public S()
Method Detail

isEmpty

public static boolean isEmpty(String s)
Determine if a given String is null or empty. By empty it means equals to "" after do a String.trim() operation on it

Parameters:
s -
Returns:
true if the String specified is empty or null

empty

public static boolean empty(String s)
Alias of isEmpty(String)

Parameters:
s -
Returns:
true if the given string is empty

isNotEmpty

public static boolean isNotEmpty(String s)
Determine if a given String is NOT null or empty.

Parameters:
s -
Returns:
false if the String specified is empty or null
See Also:
isEmpty(String)

notEmpty

public static boolean notEmpty(String s)
Alias of isNotEmpty(String)

Parameters:
s -
Returns:
true if the give string is not empty

isEmpty

public static boolean isEmpty(Object o)
Determine if a given Object instance is null or empty after it converted to a String.

Parameters:
o -
Returns:
true if the object string representation is empty
See Also:
isEmpty(String)

empty

public static boolean empty(Object o)
Alias of isEmpty(Object)

Parameters:
o -
Returns:
true if the object string representation is empty

isNotEmpty

public static boolean isNotEmpty(Object o)
Determine if a given Object instance is NOT null or empty.

Parameters:
o -
Returns:
false if the String specified is empty or null
See Also:
isEmpty(Object)

notEmpty

public static boolean notEmpty(Object o)
Alias of isNotEmpty(Object)

Parameters:
o -
Returns:
true if object str representation is not empty

isEqual

public static boolean isEqual(String s1,
                              String s2)
Check if two String is equal. This comparison is case sensitive and space sensitive

Parameters:
s1 -
s2 -
Returns:
true if the two specified Strings are equal to each other

isNotEqual

public static boolean isNotEqual(String s1,
                                 String s2)
Check if two String is not equal. This comparison is case sensitive and space sensitive

Parameters:
s1 -
s2 -
Returns:
true if the two specified Strings are not equal to each other

eq

public static boolean eq(String s1,
                         String s2)
Alias of isEqual(String, String)

Parameters:
s1 -
s2 -
Returns:
true if s1 equals s2

ne

public static boolean ne(String s1,
                         String s2)
Alias of isNotEqual(String, String)

Parameters:
s1 -
s2 -
Returns:
true if s1 not equals s2

isEqual

public static boolean isEqual(Object o1,
                              Object o2)
Check if two Object is equal after converted into String

Parameters:
o1 -
o2 -
Returns:
true if the specified two object instance are equal after converting to String

isNotEqual

public static boolean isNotEqual(Object o1,
                                 Object o2)
Check if two Object is not equal after converted into String

Parameters:
o1 -
o2 -
Returns:
true if the specified two object instance are not equal after converting to String

eq

public static boolean eq(Object o1,
                         Object o2)
Alias of isEqual(Object, Object)

Parameters:
o1 -
o2 -
Returns:
true if o1's str equals o2's str

ne

public static boolean ne(Object o1,
                         Object o2)
Alias of isNotEqual(Object, Object)

Parameters:
o1 -
o2 -
Returns:
true if o1's str not equals o2's str

eq

public static boolean eq(String s1,
                         String s2,
                         int modifier)
Alias of isEqual(String, String, int)

Parameters:
s1 -
s2 -
modifier -
Returns:
true if o1's str equals o2's str

ne

public static boolean ne(String s1,
                         String s2,
                         int modifier)
Alias of isNotEqual(String, String, int)

Parameters:
s1 -
s2 -
modifier -
Returns:
true if o1's str not equals o2's str

isEqual

public static boolean isEqual(String s1,
                              String s2,
                              int modifier)
Determine whether two string instance is equal based on the modifier passed in.

is 2 strings equal case insensitive? S.isEqual(s1, s2, S.IGNORECASE)

is 2 strings equals case and space insensitive? S.isEqual(s1, s2, S.IGNORECASE & S.IGNORESPACE)

Parameters:
s1 -
s2 -
modifier -
Returns:
true if s1 equals s2

isNotEqual

public static boolean isNotEqual(String s1,
                                 String s2,
                                 int modifier)
The counter function of isEqual(String, String, int)

Parameters:
s1 -
s2 -
modifier -
Returns:
true if s1 not equals s2

str

public static String str(Object o)
Alias of toString(Object)

Parameters:
o -
Returns:
the string representation of object

toString

public static String toString(Object o)
Safe convert an Object to String. if the Object is null than "" is returned

Parameters:
o -
Returns:
String representation of the object

removeAllLineBreaks

public static String removeAllLineBreaks(Object o)
Remove all line breaks from string representation of specified object O

Parameters:
o -
Returns:
String

raw

public static RawData raw(Object o)
Return a RawData type wrapper of an object without any escaping.

Parameters:
o -
Returns:
raw data

escape

public static RawData escape(Object o)
Return a RawData type wrapper of an object without escaping or if the current template exists return the escape specified by the current escape scheme of the current render template

Object is converted to String before escaping

Parameters:
o -
Returns:
escaped data

escape

public static RawData escape(ITemplate template,
                             Object o)
The template implicit argument version of escape(Object)

Parameters:
template -
o -
Returns:
escaped data

escape

public static RawData escape(Object o,
                             Object escape)
Return a RawData type wrapper of an object with specified escaping scheme.

You can pass any type of object to specify the escaping scheme. However they will in the end converted to converted to String and then determine which escaping to use:

Note Object instance is converted to String before escaping

Parameters:
o -
escape -
Returns:
escaped data

escapeHTML

public static RawData escapeHTML(Object o)
Return a RawData type wrapper of an object with HTML escaping

Object is converted to String before escaping

Parameters:
o -
Returns:
html escaped data

escapeHtml

public static RawData escapeHtml(Object o)
Alias of escapeHTML(Object)

Parameters:
o -
Returns:
html escaped data

escapeCSV

public static RawData escapeCSV(Object o)
Return a RawData type wrapper of an object with CSV escaping

Object is converted to String before escaping

Parameters:
o -
Returns:
csv escaped data

escapeCsv

public static RawData escapeCsv(Object o)
Alias of escapeCSV(Object)

Parameters:
o -
Returns:
CSV escaped data

escapeJSON

public static RawData escapeJSON(Object o)
Return a RawData type wrapper of an object with JSON escaping

Object is converted to String before escaping

After the object get escaped, the output string is safe to put into a JSON block

Parameters:
o -
Returns:
JSON escaped data

escapeJson

public static RawData escapeJson(Object o)
Alias of escapeCSV(Object)

Parameters:
o -
Returns:
JSON escaped data

escapeJavaScript

public static RawData escapeJavaScript(Object o)
Return a RawData type wrapper of an object with JavaScript escaping

Object is converted to String before escaping

After the object get escaped, the output string is safe to put inside a pair of JavaScript quotation marks

Parameters:
o -
Returns:
JavaScript escaped data

escapeJavascript

public static RawData escapeJavascript(Object o)
Alias of escapeJavaScript(Object)

Parameters:
o -
Returns:
JavaScript escaped data

escapeJS

public static RawData escapeJS(Object o)
Alias of escapeJavaScript(Object)

Parameters:
o -
Returns:
JavaScript escaped data

escapeJava

public static RawData escapeJava(Object o)
Return a RawData type wrapper of an object with Java escaping

Object is converted to String before escaping

After the object get escaped, the output string is safe to put inside a pair of Java quotation marks

Parameters:
o -
Returns:
Java escaped data

escapeXML

public static RawData escapeXML(Object o)
Return a RawData type wrapper of an object with XML escaping

Object is converted to String before escaping

After the object get escaped, the output string is safe to put inside a XML attribute

Parameters:
o -
Returns:
XML escaped data

escapeXml

public static RawData escapeXml(Object o)
Alias of escapeXML(Object)

Parameters:
o -
Returns:
XML escaped data

escapeRegex

public static RawData escapeRegex(Object o)
Escape for regular expression

Parameters:
o -
Returns:
Regex escaped data

strip

public static String strip(Object o,
                           String prefix,
                           String suffix)
Strip the prefix and suffix from an object's String representation and return the result

For example:

Object o = "xxBByy";
 String s = S.strip(o, "xx", "yy")

At the end above code, s should be "BB"

Parameters:
o -
prefix -
suffix -
Returns:
the String result

stripBrace

public static String stripBrace(Object o)
Strip the brace from an object's string representation and return the result

Parameters:
o -
Returns:
the string result

stripQuotation

public static String stripQuotation(Object o)
Strip the quotation mark from an object's string representation and return the result

Parameters:
o -
Returns:
the String result

stripBraceAndQuotation

public static String stripBraceAndQuotation(Object o)
Strip off both brace and quotation

Parameters:
o -
Returns:
the string result

shrinkSpace

public static String shrinkSpace(Object o)
Shrink spaces in an object's string representation by merge multiple spaces, tabs into one space, and multiple line breaks into one line break

Parameters:
o -
Returns:
the string result

isDigitsOrAlphabetic

public static boolean isDigitsOrAlphabetic(char c)

capitalizeWords

public static String capitalizeWords(Object o)
Capitalize the first character of every word of the specified object's string representation. Words are separated by space

Parameters:
o -
Returns:
the string result

noAccents

public static String noAccents(Object o)
Replace accent character (usually found in European languages) of the String representation of a give object to non-accent char.

Parameters:
o -
Returns:
the string result

lowerFirst

public static String lowerFirst(Object o)
Make the first character be lowercase of the given object's string representation

Parameters:
o -
Returns:
the string result

capFirst

public static String capFirst(Object o)
Make the first character be uppercase of the given object's string representation

Parameters:
o -
Returns:
the string result

camelCase

public static String camelCase(Object obj)
Turn an object's String representation into Camel Case

Parameters:
obj -
Returns:
the string result

divide

public static String[] divide(Object o,
                              String sep)
Bridge String.split() method to Object

Parameters:
o -
sep -
Returns:
string array separated by sep

lowerCase

public static String lowerCase(Object o)
Bridge String.toUpperCase() method to Object

Parameters:
o -
Returns:
the lower case of string presentation of o

upperCase

public static String upperCase(Object o)
Bridge String.toUpperCase() method to Object

Parameters:
o -
Returns:
the upper case of string presentation of o

len

public static int len(Object o)
get length of specified object

Parameters:
o -
Returns:
length

nl2br

public static RawData nl2br(RawData data)
Change line break in the data string into

Parameters:
data -
Returns:
raw data of transformed result

nl2br

public static RawData nl2br(Object data)
Change line break in the data string into

Parameters:
data -
Returns:
raw data of transformed result

urlEncode

public static String urlEncode(Object data)
encode using utf-8

Parameters:
data -
Returns:
encoded

format

public static String format(Number number)
Format a number using default pattern, language and locale

Parameters:
number -
Returns:
the formatted string

format

public static String format(ITemplate template,
                            Number number)
Format number with specified template

Parameters:
template -
number -
Returns:
the formatted string

format

public static String format(Number number,
                            String pattern,
                            Locale locale)
Format the number with specified pattern, language and locale

Parameters:
number -
pattern -
locale -
Returns:
the formatted String
See Also:
DecimalFormatSymbols

format

public static String format(ITemplate template,
                            Number number,
                            String pattern,
                            Locale locale)
Format the number with specified template, pattern, language and locale

Parameters:
number -
pattern -
locale -
Returns:
the formatted String
See Also:
DecimalFormatSymbols

format

public static String format(Number number,
                            String pattern)
Format a number with specified pattern

Parameters:
number -
pattern -
Returns:
formatted String

format

public static String format(ITemplate template,
                            Number number,
                            String pattern)
Format a number with specified engine, pattern

Parameters:
number -
pattern -
Returns:
formatted String

format

public static String format(Date date)
Format a date with engine's default format corresponding to the engine's locale configured

Parameters:
date -
Returns:
the formatted String

format

public static String format(ITemplate template,
                            Date date)
Format a date with specified engine's default format corresponding to the engine's locale configured

Parameters:
date -
Returns:
the formatted String

format

public static String format(Date date,
                            String pattern)
Format a date with specified pattern

Parameters:
date -
pattern -
Returns:
formated string

format

public static String format(ITemplate template,
                            Date date,
                            String pattern)
Format a date with specified pattern

Parameters:
template -
date -
pattern -
Returns:
formated string

format

public static String format(Date date,
                            String pattern,
                            Locale locale)
Transformer. Format a date with specified pattern, language and locale

Parameters:
date -
pattern -
locale -
Returns:
the formatted String

format

public static String format(ITemplate template,
                            Date date,
                            String pattern,
                            Locale locale)
See format(org.rythmengine.template.ITemplate, java.util.Date, String, java.util.Locale, String)

Parameters:
template -
date -
pattern -
locale -
Returns:
formatted date string

format

public static String format(Date date,
                            String pattern,
                            Locale locale,
                            String timezone)
Transformer. Format a date with specified pattern, lang, locale and timezone.

Parameters:
date -
pattern -
locale -
timezone -
Returns:
the formatted String
See Also:
SimpleDateFormat

format

public static String format(ITemplate template,
                            Date date,
                            String pattern,
                            Locale locale,
                            String timezone)
Format a date with specified pattern, lang, locale and timezone. The locale comes from the engine instance specified

Parameters:
template -
date -
pattern -
locale -
timezone -
Returns:
format result

formatSize

public static String formatSize(Object data)
Format size (e.g. disk space in bytes) into human readable style

The method accept any data type. When null is found then NullPointerException will be thrown out; if an Number is passed in, it will be type cast to Long; otherwise a Long.valueOf(data.toString()) is used to find out the number

Parameters:
data -
Returns:
formatted string result

formatCurrency

public static String formatCurrency(Object data)
Transformer method. Format give data into currency

Parameters:
data -
Returns:
the currency
See Also:
#formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)}

formatCurrency

public static String formatCurrency(ITemplate template,
                                    Object data)
See formatCurrency(org.rythmengine.template.ITemplate, Object)

Parameters:
template -
data -
Returns:
the currency string

formatCurrency

public static String formatCurrency(Object data,
                                    String currencyCode)
Transformer method. Format currency using specified currency code

Parameters:
data -
currencyCode -
Returns:
the currency
See Also:
#formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)}

formatCurrency

public static String formatCurrency(ITemplate template,
                                    Object data,
                                    String currencyCode)
See formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)

Parameters:
template -
data -
currencyCode -
Returns:
the currency string

formatCurrency

public static String formatCurrency(Object data,
                                    String currencyCode,
                                    Locale locale)
See formatCurrency(org.rythmengine.template.ITemplate, Object, String, java.util.Locale)

Parameters:
data -
currencyCode -
locale -
Returns:
the currency string

formatCurrency

public static String formatCurrency(ITemplate template,
                                    Object data,
                                    String currencyCode,
                                    Locale locale)
Format give data into currency using locale info from the engine specified

The method accept any data type. When null is found then NullPointerException will be thrown out; if an Number is passed in, it will be type cast to Number; otherwise a Double.valueOf(data.toString()) is used to find out the number

Parameters:
template -
data -
currencyCode -
locale -
Returns:
the currency

i18n

public static String i18n(ITemplate template,
                          String key,
                          Object... args)

Return i18n message of a given key and args, use the locale info from the template specified. if null template instance passed in then it will try to guess from the current engine via RythmEngine.get()

Parameters:
template -
key -
args - the format arguments. If the first argument is of type Locale then it will be used to specify the locale of the processing, and the rest elements are used as format arguments
Returns:
the i18n message

i18n

public static String i18n(String key,
                          Object... args)
Transformer method. Return i18n message of a given key and args.

Parameters:
key -
args -
Returns:
the i18n message

i18n

public static String i18n(String key)

random

public static String random(int len)
Generate random string. The generated string is safe to be used as filename

Parameters:
len -
Returns:
a random string with specified length

random

public static String random()
Return a random string with 8 chars

Returns:
the string generated

join

public static String join(Iterable itr)
Join items in an iterable with ","

Parameters:
itr -
Returns:
joined String

join

public static String join(Iterable itr,
                          String sep)
Join an iterable with separator

Parameters:
itr -
sep -
Returns:
the String joined

join

public static String join(Iterable itr,
                          char sep)
Join an iterable with a char separator

Parameters:
itr -
sep -
Returns:
joined string

join

public static String join(Character[] a)

join

public static String join(Character[] a,
                          String sep)

join

public static String join(Character[] a,
                          char sep)

join

public static String join(Integer[] a)

join

public static String join(Integer[] a,
                          String sep)

join

public static String join(Integer[] a,
                          char sep)

join

public static String join(Long[] a)

join

public static String join(Long[] a,
                          String sep)

join

public static String join(Long[] a,
                          char sep)

join

public static String join(Float[] a)

join

public static String join(Float[] a,
                          String sep)

join

public static String join(Float[] a,
                          char sep)

join

public static String join(Double[] a)

join

public static String join(Double[] a,
                          String sep)

join

public static String join(Double[] a,
                          char sep)


Copyright © 2013. All Rights Reserved.