org.zkoss.xel.fn
Class CommonFns

java.lang.Object
  extended by org.zkoss.xel.fn.CommonFns

public class CommonFns
extends java.lang.Object

Common functions used with EL.

Author:
tomyeh

Constructor Summary
protected CommonFns()
           
 
Method Summary
static java.lang.String getLabel(java.lang.String key)
          Returns the label or message of the specified key.
static java.lang.String getLabel(java.lang.String key, java.lang.Object[] args)
          Returns the label of the specified key and formats it with the specified argument, or null if not found.
static boolean isInstance(java.lang.Object c, java.lang.Object o)
          Tests whehter an object, o, is an instance of a class, c.
static int length(java.lang.Object o)
          Returns the length of an array, string, collection or map.
static java.lang.Object new_(java.lang.Object o)
          Instantiates the specified class.
static boolean toBoolean(java.lang.Object val)
          Converts the specified object to a boolean.
static char toChar(java.lang.Object val)
          Converts the specified object to an character.
static java.math.BigDecimal toDecimal(java.lang.Object val)
          Converts the specified object to a (big) decimal.
static int toInt(java.lang.Object val)
          Converts the specified object to an integer.
static java.lang.Number toNumber(java.lang.Object val)
          Converts the specified object to a number.
static java.lang.String toString(java.lang.Object val)
          Converts the specified object to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonFns

protected CommonFns()
Method Detail

toBoolean

public static boolean toBoolean(java.lang.Object val)
Converts the specified object to a boolean.


toString

public static java.lang.String toString(java.lang.Object val)
Converts the specified object to a string.


toNumber

public static java.lang.Number toNumber(java.lang.Object val)
Converts the specified object to a number.


toInt

public static int toInt(java.lang.Object val)
Converts the specified object to an integer.


toDecimal

public static java.math.BigDecimal toDecimal(java.lang.Object val)
Converts the specified object to a (big) decimal.


toChar

public static char toChar(java.lang.Object val)
Converts the specified object to an character.


isInstance

public static boolean isInstance(java.lang.Object c,
                                 java.lang.Object o)
Tests whehter an object, o, is an instance of a class, c.


getLabel

public static final java.lang.String getLabel(java.lang.String key)
Returns the label or message of the specified key.

See Also:
getLabel(String, Object[])

getLabel

public static final java.lang.String getLabel(java.lang.String key,
                                              java.lang.Object[] args)
Returns the label of the specified key and formats it with the specified argument, or null if not found.

It first uses getLabel(String) to load the label. Then, it, if not null, invokes MessageFormats.format(java.lang.String, java.lang.Object[], java.util.Locale) to format it.

The current locale is given by Locales.getCurrent().

Since:
3.0.6

length

public static final int length(java.lang.Object o)
Returns the length of an array, string, collection or map.


new_

public static final java.lang.Object new_(java.lang.Object o)
                                   throws java.lang.Exception
Instantiates the specified class.

Throws:
java.lang.Exception


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo