com.ibm.jps.util
Class RSMUtil

java.lang.Object
  extended by com.ibm.jps.util.RSMUtil

public class RSMUtil
extends java.lang.Object

Contains general utilities.


Constructor Summary
RSMUtil()
           
 
Method Summary
static java.lang.String convertToCamelCase(java.lang.String inputString)
          Converts an input string such as " the project name" to "theProjectName"
static java.lang.String firstCharToLowerCase(java.lang.String name)
          Changes the first letter of the specified string to lower case
static java.lang.String firstCharToUpperCase(java.lang.String name)
          Capitalizes the first letter of the specified string
static java.lang.String getDate(java.util.Locale currentLocale)
          Returns the current date as a string formatted the specified locale
static java.lang.String getPath(java.lang.String name)
          Given an input string of the type "com.company.project.AClass", getPath will return "com.company.project" (or an empty string if the input string is "AClass").
static java.lang.String getPath(java.lang.String name, char fileSeparator)
          Given an input string of the type "com?
static java.lang.String getSimpleName(java.lang.String name)
          Given an input string of the type "com.company.project.AClass", getSimpleName will return "AClass" (or the string itself if the input string is "AClass").
static java.lang.String getSimpleName(java.lang.String name, char fileSeparator)
          Given an input string of the type "com?
static java.lang.String replaceAllSubstrings(java.lang.String inputString, java.lang.String fromExp, java.lang.String toExp)
          Replaces in the input string all occurences of the from expression by the to expression
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSMUtil

public RSMUtil()
Method Detail

getPath

public static java.lang.String getPath(java.lang.String name)
Given an input string of the type "com.company.project.AClass", getPath will return "com.company.project" (or an empty string if the input string is "AClass").

Parameters:
name - The input string (e.g. "com.company.project.AClass")
Returns:
The matching path (e.g. "com.company.project") or ""

getPath

public static java.lang.String getPath(java.lang.String name,
                                       char fileSeparator)
Given an input string of the type "com?company?project?AClass" where "?" is used as a separator, getPath will return "com?company?project" (or an empty string if the input string is "AClass").

Parameters:
name - The input string (e.g. "com?company?project?AClass")
fileSeparator - The file separator (e.g. "?")
Returns:
The matching path (e.g. "com?company?project") or ""

getSimpleName

public static java.lang.String getSimpleName(java.lang.String name)
Given an input string of the type "com.company.project.AClass", getSimpleName will return "AClass" (or the string itself if the input string is "AClass").

Parameters:
name - The input string (e.g. "com.company.project.AClass")
Returns:
The 'leaf' name (e.g. "AClass")

getSimpleName

public static java.lang.String getSimpleName(java.lang.String name,
                                             char fileSeparator)
Given an input string of the type "com?company?project?AClass" where "?" is used as a separator, getSimpleName will return "AClass" (or the string itself if the input string is "AClass").

Parameters:
name - The input string (e.g. "com?company?project?AClass")
fileSeparator - The file separator (e.g. "?")
Returns:
The 'leaf' name (e.g. "AClass")

firstCharToUpperCase

public static java.lang.String firstCharToUpperCase(java.lang.String name)
Capitalizes the first letter of the specified string

Parameters:
name - The input string
Returns:
The string with the first letter capitalized

firstCharToLowerCase

public static java.lang.String firstCharToLowerCase(java.lang.String name)
Changes the first letter of the specified string to lower case

Parameters:
name - The input string
Returns:
The string with the first letter changed to lower case

getDate

public static java.lang.String getDate(java.util.Locale currentLocale)
Returns the current date as a string formatted the specified locale

Parameters:
currentLocale - The locale to use
Returns:
The formatted date

replaceAllSubstrings

public static java.lang.String replaceAllSubstrings(java.lang.String inputString,
                                                    java.lang.String fromExp,
                                                    java.lang.String toExp)
Replaces in the input string all occurences of the from expression by the to expression

Parameters:
inputString - The input string
fromExp - The substring to replace
toExp - The replacement text
Returns:
The output string

convertToCamelCase

public static java.lang.String convertToCamelCase(java.lang.String inputString)
Converts an input string such as " the project name" to "theProjectName"

Parameters:
inputString - The input string (e.g. " the project name")
Returns:
The output string (e.g. "theProjectName")