Package org.apache.axis2.util
Class JavaUtils
java.lang.Object
org.apache.axis2.util.JavaUtils
JavaUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet a string containing the stack of the current location.static StringcapitalizeFirstChar(String name) Capitalizes the first character of the name.static StringgetObjectIdentity(Object obj) Mimics the default Object.toString() produces a string of the form: obj.getClass().getName() + "@" + object's hashCode.static ClassgetWrapperClass(Class primitive) static ClassgetWrapperClass(String primitive) static booleanhasUpperCase(String word) Check if the word has any uppercase lettersstatic intindexOfIgnoreCase(String string, String search) Scans the parameter string for the parameter search ignoring case when comparing characters.static booleanstatic booleanTests the Object 'value': if its null, return default.static booleanTests the String 'value': return 'true' if its 'false', '0', or 'no' - else 'false'static booleanisFalseExplicitly(Object value) static booleanisFalseExplicitly(Object value, boolean defaultVal) Tests the Object 'value': if its null, return default.static booleanisFalseExplicitly(String value) Tests the String 'value': return 'true' if its null, 'false', '0', or 'no' - else 'false'static booleanstatic booleanisJavaKeyword(String keyword) Checks if the input string is a valid java keyword.static booleanstatic booleanTests the Object 'value': if its null, return default.static booleanTests the String 'value': return 'false' if its 'false', '0', or 'no' - else 'true'static booleanisTrueExplicitly(Object value) static booleanisTrueExplicitly(Object value, boolean defaultVal) Tests the Object 'value': if its null, return default.static booleanisTrueExplicitly(String value) Tests the String 'value': return 'true' if its 'true', '1', or 'yes' - else 'false'static StringmakeNonJavaKeyword(String keyword) Turns a java keyword string into a non-Java keyword string.static final Stringreplace: Like String.replace except that the old new items are strings.static String[]Splits the provided text into an array, separator specified.static StringGet a string containing the stack of the specified exceptionstatic StringxmlNameToJava(String name) static Stringconverts an xml name to a java identifier
-
Field Details
-
EMPTY_STRING_ARRAY
An empty immutableStringarray.
-
-
Constructor Details
-
JavaUtils
public JavaUtils()
-
-
Method Details
-
isJavaKeyword
Checks if the input string is a valid java keyword.- Returns:
- Returns boolean.
-
hasUpperCase
Check if the word has any uppercase letters- Parameters:
word-- Returns:
-
makeNonJavaKeyword
Turns a java keyword string into a non-Java keyword string. (Right now this simply means appending an underscore.) -
xmlNameToJava
-
capitalizeFirstChar
Capitalizes the first character of the name.- Parameters:
name-- Returns:
- Returns String.
-
xmlNameToJavaIdentifier
converts an xml name to a java identifier- Parameters:
name-- Returns:
- java identifier
-
isTrue
Tests the String 'value': return 'false' if its 'false', '0', or 'no' - else 'true' Follow in 'C' tradition of boolean values: false is specific (0), everything else is true; -
isTrueExplicitly
Tests the String 'value': return 'true' if its 'true', '1', or 'yes' - else 'false' -
isTrueExplicitly
Tests the Object 'value': if its null, return default. if its a Boolean, return booleanValue() if its an Integer, return 'false' if its '0' else 'true' if its a String, return isTrueExplicitly((String)value). All other types return 'true' -
isTrueExplicitly
-
isTrue
Tests the Object 'value': if its null, return default. if its a Boolean, return booleanValue() if its an Integer, return 'false' if its '0' else 'true' if its a String, return 'false' if its 'false', 'no', or '0' - else 'true' All other types return 'true' -
isTrue
-
isFalse
Tests the String 'value': return 'true' if its 'false', '0', or 'no' - else 'false' Follow in 'C' tradition of boolean values: false is specific (0), everything else is true; -
isFalseExplicitly
Tests the String 'value': return 'true' if its null, 'false', '0', or 'no' - else 'false' -
isFalseExplicitly
Tests the Object 'value': if its null, return default. if its a Boolean, return !booleanValue() if its an Integer, return 'true' if its '0' else 'false' if its a String, return isFalseExplicitly((String)value). All other types return 'false' -
isFalseExplicitly
-
isFalse
Tests the Object 'value': if its null, return default. if its a Boolean, return booleanValue() if its an Integer, return 'false' if its '0' else 'true' if its a String, return 'false' if its 'false', 'no', or '0' - else 'true' All other types return 'true' -
isFalse
-
isJavaId
-
split
Splits the provided text into an array, separator specified. This is an alternative to using StringTokenizer.
The separator is not included in the returned String array. Adjacent separators are treated as one separator.
A
nullinput String returnsnull.StringUtils.split(null, *) = null StringUtils.split("", *) = [] StringUtils.split("a.b.c", '.') = ["a", "b", "c"] StringUtils.split("a..b.c", '.') = ["a", "b", "c"] StringUtils.split("a:b:c", '.') = ["a:b:c"] StringUtils.split("a\tb\nc", null) = ["a", "b", "c"] StringUtils.split("a b c", ' ') = ["a", "b", "c"]- Parameters:
str- the String to parse, may be nullseparatorChar- the character used as the delimiter,nullsplits on whitespace- Returns:
- an array of parsed Strings,
nullif null String input
-
getWrapperClass
-
getWrapperClass
-
indexOfIgnoreCase
Scans the parameter string for the parameter search ignoring case when comparing characters.- Parameters:
string-search- If test is empty -1 is always returned.- Returns:
- -1 if the string was not found or the index of the first matching character
-
replace
replace: Like String.replace except that the old new items are strings.- Parameters:
name- stringoldT- old text to replacenewT- new text to use- Returns:
- replacement string
-
callStackToString
Get a string containing the stack of the current location. Note This utility is useful in debug scenarios to dump out the call stack.- Returns:
- String
-
stackToString
Get a string containing the stack of the specified exception- Parameters:
e-- Returns:
-
getObjectIdentity
Mimics the default Object.toString() produces a string of the form: obj.getClass().getName() + "@" + object's hashCode. This method can be used to print the debug message when you want just the short name or if using the toString will cause full expansion of underlying data structures. The returned value can also be used as an identity key.- Returns:
- obj.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(obj));
-