Example usage for Java org.springframework.util ClassUtils fields, constructors, methods, implement or subclass
The text is from its open source code.
String | ARRAY_SUFFIX Suffix for array class names: "[]" . |
String | CLASS_FILE_SUFFIX The ".class" file suffix. |
String | addResourcePathToPackagePath(Class> clazz, String resourceName) Return a path suitable for use with ClassLoader.getResource (also suitable for use with Class.getResource by prepending a slash ('/') to the return value). |
String | classPackageAsResourcePath(@Nullable Class> clazz) Given an input class object, return a string which consists of the class's package name as a pathname, i.e., all dots ('.') are replaced by slashes ('/'). |
String | convertClassNameToResourcePath(String className) Convert a "."-based fully qualified class name to a "/"-based resource path. |
String | convertResourcePathToClassName(String resourcePath) Convert a "/"-based resource path to a "."-based fully qualified class name. |
Class> | createCompositeInterface(Class>[] interfaces, @Nullable ClassLoader classLoader) Create a composite interface Class for the given interfaces, implementing the given interfaces in one single Class. |
Class> | determineCommonAncestor(@Nullable Class> clazz1, @Nullable Class> clazz2) Determine the common ancestor of the given classes, if any. |
Class> | forName(String name, @Nullable ClassLoader classLoader) Replacement for Class.forName() that also returns Class instances for primitives (e.g. |
Class>[] | getAllInterfaces(Object instance) Return all interfaces that the given instance implements as an array, including ones implemented by superclasses. |
Set | getAllInterfacesAsSet(Object instance) Return all interfaces that the given instance implements as a Set, including ones implemented by superclasses. |
Class>[] | getAllInterfacesForClass(Class> clazz) Return all interfaces that the given class implements as an array, including ones implemented by superclasses. |
Class>[] | getAllInterfacesForClass(Class> clazz, @Nullable ClassLoader classLoader) Return all interfaces that the given class implements as an array, including ones implemented by superclasses. |
Set | getAllInterfacesForClassAsSet(Class> clazz) Return all interfaces that the given class implements as a Set, including ones implemented by superclasses. |
Set | getAllInterfacesForClassAsSet(Class> clazz, @Nullable ClassLoader classLoader) Return all interfaces that the given class implements as a Set, including ones implemented by superclasses. |
String | getClassFileName(Class> clazz) Determine the name of the class file, relative to the containing package: e.g. |
Constructor | getConstructorIfAvailable(Class Determine whether the given class has a public constructor with the given signature, and return it if available (else return null ). |
ClassLoader | getDefaultClassLoader() Return the default ClassLoader to use: typically the thread context ClassLoader, if available; the ClassLoader that loaded the ClassUtils class will be used as fallback. |
String | getDescriptiveType(@Nullable Object value) Return a descriptive name for the given object's type: usually simply the class name, but component type class name + "[]" for arrays, and an appended list of implemented interfaces for JDK proxies. |
Method | getMethod(Class> clazz, String methodName, @Nullable Class>... paramTypes) Determine whether the given class has a public method with the given signature, and return it if available (else throws an IllegalStateException ). |
Method | getMethodIfAvailable(Class> clazz, String methodName, @Nullable Class>... paramTypes) Determine whether the given class has a public method with the given signature, and return it if available (else return null ). |
Method | getMostSpecificMethod(Method method, @Nullable Class> targetClass) Given a method, which may come from an interface, and a target class used in the current reflective invocation, find the corresponding target method if there is one. |
String | getPackageName(Class> clazz) Determine the name of the package of the given class, e.g. |
String | getPackageName(String fqClassName) Determine the name of the package of the given fully-qualified class name, e.g. |
String | getQualifiedMethodName(Method method) Return the qualified name of the given method, consisting of fully qualified interface/class name + "." |
String | getQualifiedMethodName(Method method, @Nullable Class> clazz) Return the qualified name of the given method, consisting of fully qualified interface/class name + "." |
String | getQualifiedName(Class> clazz) Return the qualified name of the given class: usually simply the class name, but component type class name + "[]" for arrays. |
String | getShortName(String className) Get the class name without the qualified package name. |
String | getShortName(Class> clazz) Get the class name without the qualified package name. |
String | getShortNameAsProperty(Class> clazz) Return the short string name of a Java class in uncapitalized JavaBeans property format. |
Method | getStaticMethod(Class> clazz, String methodName, Class>... args) Return a public static method of a class. |
Class> | getUserClass(Object instance) Return the user-defined class for the given instance: usually simply the class of the given instance, but the original class in case of a CGLIB-generated subclass. |
Class> | getUserClass(Class> clazz) Return the user-defined class for the given class: usually simply the given class, but the original class in case of a CGLIB-generated subclass. |
boolean | hasAtLeastOneMethodWithName(Class> clazz, String methodName) Does the given class or one of its superclasses at least have one or more methods with the supplied name (with any argument types)? |
boolean | hasConstructor(Class> clazz, Class>... paramTypes) Determine whether the given class has a public constructor with the given signature. |
boolean | hasMethod(Class> clazz, String methodName, Class>... paramTypes) Determine whether the given class has a public method with the given signature. |
boolean | isAssignable(Class> lhsType, Class> rhsType) Check if the right-hand side type may be assigned to the left-hand side type, assuming setting by reflection. |
boolean | isAssignableValue(Class> type, @Nullable Object value) Determine if the given type is assignable from the given value, assuming setting by reflection. |
boolean | isCacheSafe(Class> clazz, @Nullable ClassLoader classLoader) Check whether the given class is cache-safe in the given context, i.e. |
boolean | isCglibProxy(Object object) Check whether the given object is a CGLIB proxy. |
boolean | isCglibProxyClass(@Nullable Class> clazz) Check whether the specified class is a CGLIB-generated class. |
boolean | isJavaLanguageInterface(Class> ifc) Determine whether the given interface is a common Java language interface: Serializable , Externalizable , Closeable , AutoCloseable , Cloneable , Comparable - all of which can be ignored when looking for 'primary' user-level interfaces. |
boolean | isPresent(String className, @Nullable ClassLoader classLoader) Determine whether the Class identified by the supplied name is present and can be loaded. |
boolean | isPrimitiveArray(Class> clazz) Check if the given class represents an array of primitives, i.e. |
boolean | isPrimitiveOrWrapper(Class> clazz) Check if the given class represents a primitive (i.e. |
boolean | isPrimitiveWrapperArray(Class> clazz) Check if the given class represents an array of primitive wrappers, i.e. |
boolean | isUserLevelMethod(Method method) Determine whether the given method is declared by the user or at least pointing to a user-declared method. |
boolean | isVisible(Class> clazz, @Nullable ClassLoader classLoader) Check whether the given class is visible in the given ClassLoader. |
ClassLoader | overrideThreadContextClassLoader(@Nullable ClassLoader classLoaderToUse) Override the thread context ClassLoader with the environment's bean ClassLoader if necessary, i.e. |
Class> | resolveClassName(String className, @Nullable ClassLoader classLoader) Resolve the given class name into a Class instance. |
Class> | resolvePrimitiveIfNecessary(Class> clazz) Resolve the given class if it is a primitive class, returning the corresponding primitive wrapper type instead. |
Class>[] | toClassArray(Collection Copy the given Collection into a Class array. |