Groovy Documentation

org.grails.plugin.vaadin.utils
[Groovy] Class Utils

java.lang.Object
  org.grails.plugin.vaadin.utils.Utils

class Utils

Utility methods for Vaadin classes.

Authors:
Francis McKenzie


Constructor Summary
Utils()

 
Method Summary
static boolean containsKeyCaseInsensitive(Map props, Object key)

Case insensitive containsKey() on map.

static Object getCaseInsensitive(Map props, Object key)

Case insensitive get() on map.

static Class getCommonSuperclass(Object value)

Gets superclass that all members of specified collection have in common

static boolean isNumber(def value)

Checks if the value is a number

static Map removeAllCaseInsensitive(Map props, def keys)

Removes all entries matching the case-insensitive keys.

static Object removeCaseInsensitive(Map props, Object key)

Removes all entries matching the case-insensitive key.

static int toInt(def value)

Converts the value to an int, if not already.

static String toString(def obj)

Converts an object to a String.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

Utils

Utils()


 
Method Detail

containsKeyCaseInsensitive

static boolean containsKeyCaseInsensitive(Map props, Object key)
Case insensitive containsKey() on map.
Parameters:
key - The key to lookup
Returns:
True if the key exists in the map, matched in a case-insensitive manner


getCaseInsensitive

static Object getCaseInsensitive(Map props, Object key)
Case insensitive get() on map.
Parameters:
key - The key to lookup
Returns:
The case-sensitive value if matches. Otherwise, the last non-null case-insensitive match


getCommonSuperclass

static Class getCommonSuperclass(Object value)
Gets superclass that all members of specified collection have in common


isNumber

static boolean isNumber(def value)
Checks if the value is a number


removeAllCaseInsensitive

static Map removeAllCaseInsensitive(Map props, def keys)
Removes all entries matching the case-insensitive keys.
Parameters:
props - The map from which entries are to be removed
keys - The keys to lookup
Returns:
A map containing all entries in the specified map that were removed because their key matched one or more of the specified keys, when compared in a case-insensitive manner.


removeCaseInsensitive

static Object removeCaseInsensitive(Map props, Object key)
Removes all entries matching the case-insensitive key.
Parameters:
props - The map from which entries are to be removed
key - The key to lookup
Returns:
Either the case-sensitive match if it exists, or else returns the last case-insensitive match with a non-null value.


toInt

static int toInt(def value)
Converts the value to an int, if not already. Note this may throw an exception when parsing an invalid value or null.


toString

static String toString(def obj)
Converts an object to a String. Main benefit is that it creates a smaller representation of a Map containing long lists of objects, than is created by just calling map.toString()
Parameters:
obj - The object to stringify
Returns:
The String representation of the object.


 

Groovy Documentation