public class JavaLangUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
assignableType(Class<?> left,
Class<?> right)
It is OK to assign an expression typed right to a variable typed left.
|
static Constructor<?> |
findConstructor(Class<?> targetClass,
Class<?>[] formalArguments)
Similar to findMethod(), but for constructors rather than regular methods
|
static Method |
findMethod(Class<?> targetClass,
String name,
Class<?>[] formalArguments)
An utility building on the functionality of getMethod(), to provide the
javaMessage predicate with method argument polymorphism.
|
static String |
shortClassName(Class<?> c)
Returns just the name of the class, with no package information.
|
public static Method findMethod(Class<?> targetClass, String name, Class<?>[] formalArguments) throws NoSuchMethodException
NoSuchMethodException
public static Constructor<?> findConstructor(Class<?> targetClass, Class<?>[] formalArguments) throws NoSuchMethodException
NoSuchMethodException
public static boolean assignableType(Class<?> left, Class<?> right)
public static String shortClassName(Class<?> c)
foo.bar.Mumble
were the class passed in, the
string "Mumble"
would be returned. Similarly, if the class
that is passed in is a.b.Class$InnerClass
the string
returned would be InnerClass
.