public class SharedUtil extends Object implements Serializable
| Constructor and Description | 
|---|
SharedUtil()  | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
addGetParameter(String uri,
               String parameter,
               int value)
Adds the given get parameter to the URI and returns the new URI. 
 | 
static String | 
addGetParameter(String uri,
               String parameter,
               String value)
Adds the given get parameter to the URI and returns the new URI. 
 | 
static String | 
addGetParameters(String uri,
                String extraParams)
Adds the get parameters to the uri and returns the new uri that contains
 the parameters. 
 | 
static String | 
camelCaseToDashSeparated(String camelCaseString)
Converts a camelCase string into dash ("-") separated. 
 | 
static String | 
camelCaseToHumanFriendly(String camelCaseString)
Converts a camelCaseString to a human friendly format (Camel case
 string). 
 | 
static String | 
capitalize(String string)
Capitalizes the first character in the given string in a way suitable for
 use in code (methods, properties etc). 
 | 
static String | 
dashSeparatedToCamelCase(String dashSeparated)
Converts a dash ("-") separated string into camelCase. 
 | 
static String | 
firstToLower(String string)
Changes the first character in the given string to lower case in a way
 suitable for use in code (methods, properties etc). 
 | 
static String | 
join(String[] parts,
    String separator)
Joins the words in the input array together into a single string by
 inserting the separator string between each word. 
 | 
static String | 
prefixIfRelative(String url,
                String prefix)
Prepend the given url with the prefix if it is not absolute and doesn't
 have a protocol. 
 | 
static String | 
propertyIdToHumanFriendly(Object propertyId)
Converts a property id to a human friendly format. 
 | 
static String[] | 
splitCamelCase(String camelCaseString)
Splits a camelCaseString into an array of words with the casing
 preserved. 
 | 
static String | 
trimTrailingSlashes(String value)
Trims trailing slashes (if any) from a string. 
 | 
public static String trimTrailingSlashes(String value)
value - The string value to be trimmed. Cannot be null.public static String[] splitCamelCase(String camelCaseString)
camelCaseString - The input string in camelCase formatpublic static String camelCaseToHumanFriendly(String camelCaseString)
In general splits words when the casing changes but also handles special cases such as consecutive upper case characters. Examples:
MyBeanContainer becomes My Bean Container AwesomeURLFactory becomes Awesome URL Factory SomeUriAction becomes Some Uri Action
camelCaseString - The input string in camelCase formatpublic static String join(String[] parts, String separator)
parts - The array of wordsseparator - The separator string to use between wordspublic static String capitalize(String string)
string - The string to capitalizepublic static String firstToLower(String string)
string - The string to changepublic static String propertyIdToHumanFriendly(Object propertyId)
propertyId - The propertyId to formatpublic static String addGetParameter(String uri, String parameter, String value)
uri - the URI to which the parameter should be added.parameter - the name of the parametervalue - the value of the parameterpublic static String addGetParameter(String uri, String parameter, int value)
uri - the URI to which the parameter should be added.parameter - the name of the parametervalue - the value of the parameterpublic static String addGetParameters(String uri, String extraParams)
uri - The uri to which the parameters should be added.extraParams - One or more parameters in the format "a=b" or "c=d&e=f".
            An empty string is allowed but will not modify the url.public static String dashSeparatedToCamelCase(String dashSeparated)
Examples:
foo becomes foo foo-bar becomes fooBar foo--bar becomes fooBar
dashSeparated - The dash separated string to convertpublic static String camelCaseToDashSeparated(String camelCaseString)
Examples:
foo becomes foo fooBar becomes foo-bar MyBeanContainer becomes -my-bean-container AwesomeURLFactory becomes -awesome-uRL-factory someUriAction becomes some-uri-action
camelCaseString - The input string in camelCase formatCopyright © 2021. All rights reserved.