public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static Class<?>[] |
getImplementedInterfaces(Class<?> clazz)
Get the
Class objects corresponding to the interfaces implemented by the given class. |
static String |
getPackageName(Class<?> clazz)
Get the name of the package that the supplied class belongs to
|
static boolean |
isJdbcInterface(Class<?> clazz)
Check whether the given class implements a JDBC interface defined in a JDBC package.
|
static boolean |
isJdbcPackage(@Nullable String packageName)
Check whether the given package is a JDBC package
|
static boolean |
isNullOrEmpty(@Nullable String s)
Check if the supplied string is null or empty
|
static @Nullable HostSpec |
parseUrl(@Nullable String url)
Splits a URL into its host/port components and returns this information as a
HostSpec |
static String |
shadingPrefix(String clazzName)
Adds the shading package prefix to a class name and returns it.
|
static String |
stackTraceToString(Throwable t,
Class callingClass)
For the given
Throwable , return a formatted string representation of the stack trace. |
public static String getPackageName(Class<?> clazz)
clazz
- the Class
to analyzepublic static String shadingPrefix(String clazzName)
clazzName
- Class name.public static boolean isJdbcInterface(Class<?> clazz)
isJdbcPackage(String)
Calls to this function are cached for improved efficiency.clazz
- the class to analyzepublic static boolean isJdbcPackage(@Nullable String packageName)
packageName
- the name of the package to analyzepublic static Class<?>[] getImplementedInterfaces(Class<?> clazz)
Class
objects corresponding to the interfaces implemented by the given class. Calls to this function
are cached for improved efficiency.clazz
- the class to analyzepublic static String stackTraceToString(Throwable t, Class callingClass)
Throwable
, return a formatted string representation of the stack trace. This method is
provided for logging purposes.t
- the throwable containing the stack trace that we want to transform into a stringcallingClass
- the class that is calling this methodThrowable
public static @Nullable HostSpec parseUrl(@Nullable String url)
HostSpec
url
- the URL to processHostSpec
representing the host/port components of the given URL, or null if
there was a problem parsing the URL@EnsuresNonNullIf(expression="#1", result=false) public static boolean isNullOrEmpty(@Nullable String s)
s
- the string to analyzeCopyright © 1997-2021 PostgreSQL Global Development Group. All Rights Reserved.