public class TypeUtil extends Object
| Constructor and Description |
|---|
TypeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
addCommas(float f)
Deprecated.
Use standard java.* APIs which create the correct
localized number format.
|
static String |
addCommas(String numStr)
Deprecated.
Use standard java.* APIs which create the correct
localized number format.
|
static String |
arrayToString(String[] from,
String separator)
Convert an array of strings to a single line with elements separated
by the given separator.
|
static Method |
getDeclaredMethod(Class declaringClass,
ClassLoader loader,
String name,
String[] paramClassNames) |
static Method |
getMethod(Class declaringClass,
ClassLoader loader,
String name,
String[] paramClassNames) |
static Set |
getSuperInterfaces(ClassLoader cl,
String className,
String baseClassName)
Get all super-interfaces of a class, excluding the
given base interface.
|
static int |
hashCode(String s)
Work around a performance bug in String.hashCode() for strings longer
than sixteen characters, by calculating a (slower) hash on all the
characters in the string.
|
static int |
intGetBytes(int src,
byte[] buf,
int offset)
Place a byte representation of src into the byte array buf.
|
static int |
intGetChars(int src,
char[] buf,
int offset)
Place a character representation of src into the buffer.
|
static boolean |
isSubclassOf(Class sub,
Class sup)
Deprecated.
Use sup.isAssignableFrom(sub)
|
static Class[] |
paramClassNamesToTypes(String[] paramClassNames,
ClassLoader loader)
Convert String array of class names into array of Classes.
|
static String |
propertyNameToSetterMethod(String propertyName)
Convert a java beans property name to a setter method name
|
static boolean |
sameMethodSignature(Method m1,
Method m2)
Compares the signatures of two methods to see if they
have the same method name, parameters, and return type.
|
static boolean |
sameParamTypes(Method m1,
Method m2)
Compares the signatures of two methods to see if they
have the same numer of parameters and same parameter types.
|
static String |
setterMethodToPropertyName(String setterMethodName)
Convert a java beans setter method to its property name.
|
static String[] |
stringToArray(String from,
String separator)
Convert a string of delimited strings to an array of strings.
|
static String |
truncateFloat(float f,
int digits)
Truncate a float to the required number of significant digits.
|
static String[] |
wordWrap(String msg,
int widthInChars)
Word-wrap a string into an array of strings.
|
public static int intGetChars(int src,
char[] buf,
int offset)
src - - the integer to convert. Must not be Integer.MIN_VALUE.buf - - the buf to put the result inoffset - - the offset in buf to place the first digitIllegalArgumentException - if src is Integer.MIN_VALUE.public static int intGetBytes(int src,
byte[] buf,
int offset)
src - - the integer to convert. Must not be Integer.MIN_VALUE.buf - - the buf to put the result inoffset - - the offset in buf to place the first digitIllegalArgumentException - if src is Integer.MIN_VALUE.public static int hashCode(String s)
public static String[] wordWrap(String msg, int widthInChars)
public static String arrayToString(String[] from, String separator)
join.from - the array of strings to convertseparator - the string to insert between each elementpublic static String[] stringToArray(String from, String separator)
split.from - the string to convertseparator - the delimiterpublic static String truncateFloat(float f, int digits)
public static String addCommas(float f)
public static String addCommas(String numStr)
public static boolean isSubclassOf(Class sub, Class sup)
public static Set getSuperInterfaces(ClassLoader cl, String className, String baseClassName) throws ClassNotFoundException
ClassNotFoundExceptionpublic static Method getMethod(Class declaringClass, ClassLoader loader, String name, String[] paramClassNames) throws Exception
Exceptionpublic static Method getDeclaredMethod(Class declaringClass, ClassLoader loader, String name, String[] paramClassNames) throws Exception
Exceptionpublic static boolean sameParamTypes(Method m1, Method m2)
public static boolean sameMethodSignature(Method m1, Method m2)
public static String setterMethodToPropertyName(String setterMethodName)
public static String propertyNameToSetterMethod(String propertyName)
public static Class[] paramClassNamesToTypes(String[] paramClassNames, ClassLoader loader) throws Exception
ExceptionCopyright © 2019. All rights reserved.