public class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
floatToString(float fValue)
Converts a float value to a String value
|
protected static org.apache.commons.httpclient.NameValuePair[] |
getHTTPParams(java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> params)
Returns an array of name/value pair objects representing map entry values in a list.
|
protected static org.apache.commons.httpclient.NameValuePair[] |
getHTTPParams(java.util.Map<java.lang.String,java.lang.String> params)
Returns an array of name/value pair objects representing values in a map.
|
protected static java.lang.String |
getRandomString(int length)
Generates a random string.
|
protected static org.jdom.Element |
getXmlChild(org.jdom.Element root,
java.lang.String name)
Returns a named XML child element given a parent element.
|
protected static java.lang.String |
getXmlChildValue(org.jdom.Element root,
java.lang.String name)
Returns the value of a named XML child element given a parent element.
|
protected static org.jdom.Document |
getXMLDoc(java.lang.String xml)
Returns an XML document from an XML String
|
protected static java.lang.String |
quoted(java.lang.String value,
boolean addQuotes)
Returns a string in quotes for use in a database query.
|
static java.lang.Float |
stringToFloat(java.lang.String value)
Converts a String value to a float value
|
protected static java.lang.String |
urlEncode(java.lang.String value)
Returns a URL-encoded string.
|
public static java.lang.Float stringToFloat(java.lang.String value)
value
- string to be convertedpublic static java.lang.String floatToString(float fValue)
fValue
- to be convertedprotected static java.lang.String getRandomString(int length)
The generated string will only comprise letters (upper- and lower-case) and digits.
length
- Length of string to be generatedprotected static java.lang.String quoted(java.lang.String value, boolean addQuotes)
Any single quotes in the value passed will be replaced with two single quotes. If a null value is passed, a string of 'NULL' is returned (which will never be enclosed in quotes irrespective of the value of the $addQuotes parameter.
value
- value to be quotedaddQuotes
- true
if the returned string is to be enclosed in single quotestrue
if the user object was successfully deletedprotected static java.lang.String urlEncode(java.lang.String value)
value
- value to be encodedprotected static org.apache.commons.httpclient.NameValuePair[] getHTTPParams(java.util.Map<java.lang.String,java.lang.String> params)
params
- map of String valuesprotected static org.apache.commons.httpclient.NameValuePair[] getHTTPParams(java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> params)
params
- list of map entry valuesprotected static org.jdom.Document getXMLDoc(java.lang.String xml)
xml
- String containing XMLprotected static org.jdom.Element getXmlChild(org.jdom.Element root, java.lang.String name)
The first element will be returned if more than one exists with the given name. The first child element will be returned if the name is null.
root
- parent elementname
- name of child elementprotected static java.lang.String getXmlChildValue(org.jdom.Element root, java.lang.String name)
The value of the first element will be returned if more than one exists with the given name. The value of the first child element will be returned if the name is null.
root
- parent elementname
- name of child element