org.apache.airavata.common.utils
Class StringUtil

java.lang.Object
  extended by org.apache.airavata.common.utils.StringUtil

public class StringUtil
extends Object


Constructor Summary
StringUtil()
           
 
Method Summary
static String convertToJavaIdentifier(String name)
          Converts a specified string to a Java identifier.
static String getClassName(Class klass)
          Returns the local class name of a specified class.
static String getStackTraceInString(Throwable throwable)
           
static String incrementName(String oldName)
          Creates a new name by incrementing the number after the underscore at the end of the old name.
static String toString(Object object)
          Converts object to String without worrying about null check.
static String trimAndNullify(String string)
          Trims a specified string, and makes it null if the result is empty string.
static String trimSpaceInString(String oldName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

toString

public static String toString(Object object)
Converts object to String without worrying about null check.

Parameters:
object -
Returns:
The object.toString if object is not null; "" otherwise.

trimAndNullify

public static String trimAndNullify(String string)
Trims a specified string, and makes it null if the result is empty string.

Parameters:
string -
Returns:
the string processed

trimSpaceInString

public static String trimSpaceInString(String oldName)
Parameters:
oldName -
Returns:
Trimmed String

convertToJavaIdentifier

public static String convertToJavaIdentifier(String name)
Converts a specified string to a Java identifier.

Parameters:
name -
Returns:
the Java identifier

incrementName

public static String incrementName(String oldName)
Creates a new name by incrementing the number after the underscore at the end of the old name. If there is no underscore and number at the end, put "_2" at the end.

Parameters:
oldName -
Returns:
the new name

getClassName

public static String getClassName(Class klass)
Returns the local class name of a specified class.

Parameters:
klass - The specified class
Returns:
The local class name

getStackTraceInString

public static String getStackTraceInString(Throwable throwable)
Parameters:
throwable -
Returns:
The stackTrace in String


Copyright © 2011-2012 The Apache Software Foundation. All Rights Reserved.