public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static Method |
findFullyQualifiedMethod(String name,
Class<?>... params)
Attempts to find a method given its fully-qualified name (eg:
com.example.package.MyClass.myMethod). |
static Method |
findMethodIfExists(Class<?> klass,
String methodName,
Class<?>... paramTypes)
Returns a declared or inherited method with the specified parameter types,
null if one doesn't exist or the passed class is null. |
static Class<?> |
loadClass(String fullyQualifiedName)
Attempts to load a class, returning
null if it doesn't exist. |
static void |
sleepQuietly(long time)
Sleeps until the specified time elapses or the thread is interrupted.
|
public static void sleepQuietly(long time)
public static Class<?> loadClass(String fullyQualifiedName)
null if it doesn't exist.public static Method findMethodIfExists(Class<?> klass, String methodName, Class<?>... paramTypes)
null if one doesn't exist or the passed class is null.public static Method findFullyQualifiedMethod(String name, Class<?>... params) throws ClassNotFoundException, NoSuchMethodException
com.example.package.MyClass.myMethod). Typically used
for static factory method lookup, but can be used for instance
methods as well.IllegalArgumentException - if unable parse the method name.ClassNotFoundException - if unable to load the specified class.NoSuchMethodException - if unable to find a method with the given parameters.Copyright © 2023. All rights reserved.