Package rife.tools
Class ClassUtils
java.lang.Object
rife.tools.ClassUtils
The ClassUtils class provides useful utility methods for working with Java classes.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
getEnumClassValues
(Class klass) Returns an array of the values of the enum constants of the specified class, or null if the class is not an enum.static boolean
Returns true if the specified class is a basic type.static boolean
Returns true if the specified class is from the JDK.static boolean
Returns true if the specified class is numeric.static boolean
Returns true if the specified class is text.static String
shortenClassName
(Class klass) Returns a shortened version of the specified class name, with "$" characters replaced by underscores.static String
simpleClassName
(Class klass) Returns the simple name of the specified class without the package name.
-
Method Details
-
isNumeric
Returns true if the specified class is numeric.- Parameters:
klass
- the class to check- Returns:
- true if the specified class is numeric, false otherwise
- Since:
- 1.0
-
isText
Returns true if the specified class is text.- Parameters:
klass
- the class to check- Returns:
- true if the specified class is text, false otherwise
- Since:
- 1.0
-
isBasic
Returns true if the specified class is a basic type.- Parameters:
klass
- the class to check- Returns:
- true if the specified class is a basic type, false otherwise
- Since:
- 1.0
-
isFromJdk
Returns true if the specified class is from the JDK.- Parameters:
klass
- the class to check- Returns:
- true if the specified class is from the JDK, false otherwise
- Since:
- 1.0
-
simpleClassName
Returns the simple name of the specified class without the package name.- Parameters:
klass
- the class whose simple name to return- Returns:
- the simple name of the specified class
- Since:
- 1.0
-
shortenClassName
Returns a shortened version of the specified class name, with "$" characters replaced by underscores.- Parameters:
klass
- the class whose name to shorten- Returns:
- a shortened version of the specified class name
- Since:
- 1.0
-
getEnumClassValues
Returns an array of the values of the enum constants of the specified class, or null if the class is not an enum.- Parameters:
klass
- the class whose enum constant values to return- Returns:
- an array of the values of the enum constants of the specified class, or null if the class is not an enum
- Since:
- 1.0
-