play.templates
Class JavaExtensions
java.lang.Object
play.templates.JavaExtensions
public class JavaExtensions
- extends java.lang.Object
Java extensions in templates
Method Summary |
static java.lang.String[] |
add(java.lang.String[] array,
java.lang.String o)
|
static java.lang.String |
addSlashes(java.lang.Object o)
|
static BaseTemplate.RawData |
asAttr(java.util.Map attributes)
|
static BaseTemplate.RawData |
asAttr(java.util.Map attributes,
java.lang.Object condition)
|
static java.lang.String |
asdate(java.lang.Long timestamp,
java.lang.String pattern)
|
static java.lang.String |
asdate(java.lang.Long timestamp,
java.lang.String pattern,
java.lang.String lang)
|
static groovy.util.slurpersupport.GPathResult |
asXml(java.lang.String xml)
|
static java.lang.String |
camelCase(java.lang.String string)
|
static java.lang.String |
capAll(java.lang.Object o)
|
static java.lang.String |
capFirst(java.lang.Object o)
|
static java.lang.String |
capitalizeWords(java.lang.String source)
|
static boolean |
contains(java.lang.String[] array,
java.lang.String value)
|
static java.lang.String |
cut(java.lang.Object o,
java.lang.String pattern)
|
static boolean |
divisibleBy(java.lang.Number n,
int by)
|
static BaseTemplate.RawData |
escape(java.lang.Object o)
|
static BaseTemplate.RawData |
escapeHtml(java.lang.String htmlToEscape)
|
static java.lang.String |
escapeJavaScript(java.lang.String str)
|
static java.lang.String |
escapeXml(java.lang.String str)
|
protected static boolean |
eval(java.lang.Object condition)
|
static java.lang.String |
format(java.util.Date date)
|
static java.lang.String |
format(java.util.Date date,
java.lang.String pattern)
|
static java.lang.String |
format(java.util.Date date,
java.lang.String pattern,
java.lang.String lang)
|
static java.lang.String |
format(java.lang.Number number,
java.lang.String pattern)
|
static java.lang.String |
formatCurrency(java.lang.Number number,
java.lang.String currencyCode)
|
static java.lang.String |
formatSize(java.lang.Long bytes)
|
static java.lang.String |
join(java.util.Collection items,
java.lang.String separator)
concatenate items of a collection as a string separated with separator
items toString() method should be implemented to provide a string representation |
static java.lang.Object |
last(java.util.List<?> items)
return the last item of a list or null if the List is null |
static BaseTemplate.RawData |
nl2br(java.lang.Object data)
|
static java.lang.String |
noAccents(java.lang.String string)
|
static java.lang.String |
pad(java.lang.String str,
java.lang.Integer size)
|
static java.lang.Integer |
page(java.lang.Number number,
java.lang.Integer pageSize)
|
static java.lang.String |
pluralize(java.util.Collection n)
|
static java.lang.String |
pluralize(java.util.Collection n,
java.lang.String plural)
|
static java.lang.String |
pluralize(java.util.Collection n,
java.lang.String[] forms)
|
static java.lang.String |
pluralize(java.lang.Number n)
|
static java.lang.String |
pluralize(java.lang.Number n,
java.lang.String plural)
|
static java.lang.String |
pluralize(java.lang.Number n,
java.lang.String[] forms)
|
static BaseTemplate.RawData |
raw(java.lang.Object val)
|
static BaseTemplate.RawData |
raw(java.lang.Object val,
java.lang.Object condition)
|
static java.lang.String[] |
remove(java.lang.String[] array,
java.lang.String s)
|
static java.lang.String |
since(java.util.Date date)
|
static java.lang.String |
since(java.util.Date date,
java.lang.Boolean stopAtMonth)
|
static java.lang.String |
slugify(java.lang.String string)
|
static java.lang.String |
toString(groovy.lang.Closure closure)
|
static java.lang.String |
urlEncode(java.lang.String entity)
|
static java.lang.String |
yesno(java.lang.Object o,
java.lang.String[] values)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaExtensions
public JavaExtensions()
contains
public static boolean contains(java.lang.String[] array,
java.lang.String value)
asXml
public static groovy.util.slurpersupport.GPathResult asXml(java.lang.String xml)
add
public static java.lang.String[] add(java.lang.String[] array,
java.lang.String o)
remove
public static java.lang.String[] remove(java.lang.String[] array,
java.lang.String s)
toString
public static java.lang.String toString(groovy.lang.Closure closure)
capitalizeWords
public static java.lang.String capitalizeWords(java.lang.String source)
pad
public static java.lang.String pad(java.lang.String str,
java.lang.Integer size)
escapeHtml
public static BaseTemplate.RawData escapeHtml(java.lang.String htmlToEscape)
escapeJavaScript
public static java.lang.String escapeJavaScript(java.lang.String str)
raw
public static BaseTemplate.RawData raw(java.lang.Object val)
raw
public static BaseTemplate.RawData raw(java.lang.Object val,
java.lang.Object condition)
asAttr
public static BaseTemplate.RawData asAttr(java.util.Map attributes,
java.lang.Object condition)
asAttr
public static BaseTemplate.RawData asAttr(java.util.Map attributes)
eval
protected static boolean eval(java.lang.Object condition)
escapeXml
public static java.lang.String escapeXml(java.lang.String str)
format
public static java.lang.String format(java.lang.Number number,
java.lang.String pattern)
format
public static java.lang.String format(java.util.Date date)
format
public static java.lang.String format(java.util.Date date,
java.lang.String pattern)
format
public static java.lang.String format(java.util.Date date,
java.lang.String pattern,
java.lang.String lang)
page
public static java.lang.Integer page(java.lang.Number number,
java.lang.Integer pageSize)
since
public static java.lang.String since(java.util.Date date)
since
public static java.lang.String since(java.util.Date date,
java.lang.Boolean stopAtMonth)
asdate
public static java.lang.String asdate(java.lang.Long timestamp,
java.lang.String pattern)
asdate
public static java.lang.String asdate(java.lang.Long timestamp,
java.lang.String pattern,
java.lang.String lang)
nl2br
public static BaseTemplate.RawData nl2br(java.lang.Object data)
urlEncode
public static java.lang.String urlEncode(java.lang.String entity)
formatSize
public static java.lang.String formatSize(java.lang.Long bytes)
formatCurrency
public static java.lang.String formatCurrency(java.lang.Number number,
java.lang.String currencyCode)
addSlashes
public static java.lang.String addSlashes(java.lang.Object o)
capFirst
public static java.lang.String capFirst(java.lang.Object o)
capAll
public static java.lang.String capAll(java.lang.Object o)
cut
public static java.lang.String cut(java.lang.Object o,
java.lang.String pattern)
divisibleBy
public static boolean divisibleBy(java.lang.Number n,
int by)
escape
public static BaseTemplate.RawData escape(java.lang.Object o)
pluralize
public static java.lang.String pluralize(java.lang.Number n)
pluralize
public static java.lang.String pluralize(java.util.Collection n)
pluralize
public static java.lang.String pluralize(java.lang.Number n,
java.lang.String plural)
pluralize
public static java.lang.String pluralize(java.util.Collection n,
java.lang.String plural)
pluralize
public static java.lang.String pluralize(java.lang.Number n,
java.lang.String[] forms)
pluralize
public static java.lang.String pluralize(java.util.Collection n,
java.lang.String[] forms)
noAccents
public static java.lang.String noAccents(java.lang.String string)
slugify
public static java.lang.String slugify(java.lang.String string)
camelCase
public static java.lang.String camelCase(java.lang.String string)
yesno
public static java.lang.String yesno(java.lang.Object o,
java.lang.String[] values)
last
public static java.lang.Object last(java.util.List<?> items)
- return the last item of a list or null if the List is null
join
public static java.lang.String join(java.util.Collection items,
java.lang.String separator)
- concatenate items of a collection as a string separated with separator
items toString() method should be implemented to provide a string representation
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly