eXo Kernel :: Commons Utils 2.4.13-GA

org.exoplatform.commons.utils
Class Tools

java.lang.Object
  extended by org.exoplatform.commons.utils.Tools

public class Tools
extends Object

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
Tools()
           
 
Method Summary
static Map<String,String> asMap(Properties props)
          Copy the properties state and returns it as a modifiable map.
static Properties asProperties(Map<String,String> map)
          Copy the provided map and returns it as a modifiable properties object.
static boolean endsWithIgnoreCase(String s, String end)
          Returns true if the string s ends with the end string ignoring the case.
static TimeZone getTimeZone(String ID)
          This method is similar to TimeZone.getTimeZone(String) with less contention
static Set<String> parseCommaList(String s)
          Parse the provided list according to the comma separator.
static
<E> Set<E>
set(E... elements)
          Instantiates a HashSet object and fills it with the provided element array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tools

public Tools()
Method Detail

set

public static <E> Set<E> set(E... elements)
                  throws IllegalArgumentException
Instantiates a HashSet object and fills it with the provided element array.

Type Parameters:
E - the element type
Parameters:
elements - the list of elements to add
Returns:
the set of elements
Throws:
IllegalArgumentException - if the element array is null

parseCommaList

public static Set<String> parseCommaList(String s)
                                  throws IllegalArgumentException
Parse the provided list according to the comma separator. The string is sliced first using the String.split(String) method with the "," argument. Each chunk is then trimmed and if its length is not zero then it is added to the returned set.

Parameters:
s - the list to parse
Returns:
the set of string found in the list
Throws:
IllegalArgumentException - if the string argument is null

asProperties

public static Properties asProperties(Map<String,String> map)
                               throws IllegalArgumentException
Copy the provided map and returns it as a modifiable properties object.

Parameters:
map - the map to copy
Returns:
the properties copy
Throws:
IllegalArgumentException - if the map argument is null

asMap

public static Map<String,String> asMap(Properties props)
                                throws IllegalArgumentException
Copy the properties state and returns it as a modifiable map. Only the key and value of type string are copied.

Parameters:
props - the properties object to copy
Returns:
the properties copy as a map
Throws:
IllegalArgumentException - if the props argument is null

endsWithIgnoreCase

public static boolean endsWithIgnoreCase(String s,
                                         String end)
                                  throws IllegalArgumentException
Returns true if the string s ends with the end string ignoring the case.

Parameters:
s - the string to test
end - the string suffix
Returns:
true if the string s ends with the end string ignoring the case
Throws:
IllegalArgumentException - if any string is null

getTimeZone

public static TimeZone getTimeZone(String ID)
This method is similar to TimeZone.getTimeZone(String) with less contention


eXo Kernel :: Commons Utils 2.4.13-GA

Copyright © 2015 eXo Platform SAS. All Rights Reserved.