Package org.exoplatform.commons.utils
Class Tools
java.lang.Object
org.exoplatform.commons.utils.Tools
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasMap(Properties props) Copy the properties state and returns it as a modifiable map.static PropertiesasProperties(Map<String, String> map) Copy the provided map and returns it as a modifiable properties object.static booleanendsWithIgnoreCase(String s, String end) Returns true if the string s ends with the end string ignoring the case.static TimeZonegetTimeZone(String ID) This method is similar toTimeZone.getTimeZone(String)with less contentionParse the provided list according to the comma separator.static <E> Set<E> set(E... elements) Instantiates aHashSetobject and fills it with the provided element array.
-
Constructor Details
-
Tools
public Tools()
-
-
Method Details
-
set
Instantiates aHashSetobject 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
Parse the provided list according to the comma separator. The string is sliced first using theString.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
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
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
Returns true if the string s ends with the end string ignoring the case.- Parameters:
s- the string to testend- 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
This method is similar toTimeZone.getTimeZone(String)with less contention
-